Skip to content

Instantly share code, notes, and snippets.

@indigo0086
Created February 3, 2014 22:21
Show Gist options
  • Save indigo0086/8793650 to your computer and use it in GitHub Desktop.
Save indigo0086/8793650 to your computer and use it in GitHub Desktop.
async.js with bcrypt
var bcrypt = require("bcrypt"),
async = require("async");
function genHash(username, password, doneCallback) {
async.waterfall([
function(hashCallback) {
bcrypt.genSalt(10, hashCallback);
},
function(salt, callback) {
bcrypt.hash(password, salt, callback);
}
], function(err, hash) {
doneCallback(err, hash);
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment