Skip to content

Instantly share code, notes, and snippets.

@lusentis
Last active December 20, 2015 13:29
Show Gist options
  • Save lusentis/6139172 to your computer and use it in GitHub Desktop.
Save lusentis/6139172 to your computer and use it in GitHub Desktop.
Hashes an user-entered password.
/*jshint node:true */
'use strict';
var bcrypt = require('bcrypt')
, read = require('read');
read({ prompt: 'Password (typing will be hidden): ', silent: true, replace: '*' }, function (err, pass) {
var hash = bcrypt.hashSync(pass, 12);
process.stdout.write(hash + '\n');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment