Skip to content

Instantly share code, notes, and snippets.

@markandrewj
Forked from dezull/hash-password.js
Created August 30, 2014 12:15
Show Gist options
  • Save markandrewj/f25642b5108a141afcf1 to your computer and use it in GitHub Desktop.
Save markandrewj/f25642b5108a141afcf1 to your computer and use it in GitHub Desktop.
// 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