I am currently using the following for hashing passwords:
var pass_shasum = crypto.createHash(\'sha256\').update(req.body.password).digest(\'hex\');
You can use the bcrypt-js package for encrypting the password.
bcrypt.genSalt(10, function(err, salt) {
bcrypt.hash("B4c0/\/", salt, function(err, hash) {
// Store hash in your password DB.
});
});
// Load hash from your password DB.
bcrypt.compare("B4c0/\/", hash, function(err, res) {
// res === true
});
You can visit https://www.npmjs.com/package/bcryptjs for more information on bcryptjs.