Skip to content

Instantly share code, notes, and snippets.

@dezull
Created February 9, 2014 04:19
Show Gist options
  • Save dezull/8894202 to your computer and use it in GitHub Desktop.
Save dezull/8894202 to your computer and use it in GitHub Desktop.
node bcrypt example
// 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