Skip to content

Instantly share code, notes, and snippets.

@lovio
Created June 4, 2014 09:36
Show Gist options
  • Save lovio/5c9a5d817d55c94894c2 to your computer and use it in GitHub Desktop.
Save lovio/5c9a5d817d55c94894c2 to your computer and use it in GitHub Desktop.
Using pbkdf2
var crypto = require('crypto');
var makeSalt = function() {
return crypto.randomBytes(16).toString('base64');
};
var hashPassword = function(password){
var salt = new Buffer(makeSalt, 'base64');
return crypto.pbkdf2Sync(password, salt, 10000, 64).toString('base64');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment