Created
June 4, 2014 09:36
-
-
Save lovio/5c9a5d817d55c94894c2 to your computer and use it in GitHub Desktop.
Using pbkdf2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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