Skip to content

Instantly share code, notes, and snippets.

@taylortom
Created November 16, 2016 11:01
Show Gist options
  • Save taylortom/48b24b7fc4576b9c97c7d8477d7636d5 to your computer and use it in GitHub Desktop.
Save taylortom/48b24b7fc4576b9c97c7d8477d7636d5 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