Created
February 9, 2014 04:19
-
-
Save dezull/8894202 to your computer and use it in GitHub Desktop.
node bcrypt example
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
// npm install bcrypt | |
var bcrypt = require('bcrypt'); | |
var password = process.argv[2]; | |
bcrypt.genSalt(function(err, salt) { | |
if (err) { | |
console.log(err); | |
} | |
console.log('salt: ' + salt + ' (length: ' + salt.length + ')'); | |
bcrypt.hash(password, salt, function(err, encrypted) { | |
if (err) { | |
console.log(err); | |
} | |
console.log('encrypted: ' + encrypted + ' (length: ' + encrypted.length + ')'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment