Skip to content

Instantly share code, notes, and snippets.

@dennis-learningpool
Created October 20, 2015 16:28
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dennis-learningpool/4a4a9c01017bc9640478 to your computer and use it in GitHub Desktop.
Save dennis-learningpool/4a4a9c01017bc9640478 to your computer and use it in GitHub Desktop.
var bcrypt = require('bcrypt-nodejs');
var usage = 'usage: node passwordgen.js <password>';
if (process.argv.length != 3) {
console.log(usage);
process.exit(1);
}
var plaintext = process.argv[2];
bcrypt.genSalt(10, function (err, salt) {
bcrypt.hash(plaintext, salt, null, function (err, hash) {
console.log(hash);
process.exit(0);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment