Open neilbalch opened 7 years ago
@neilbalch pass a salt, not a number.
var bcryptNodejs = require("bcrypt-nodejs")
var salt = bcryptNodejs.genSaltSync(10);
var hash = bcryptNodejs.hashSync("bacon", salt);
console.log(hash);
What about
collection.find({}).toArray((err,data) => {
console.log('\x1b[36m%s\x1b[34m', 'Getting... data.');
async.forEach(data, (item,callback) => {
let regex = new RegExp('^\$2[ayb]\$.{56}$');
/*
^\$2[ayb]\$.{56}$
*/
let salt = bCrypt.genSaltSync(128);
if(!regex.test(item.pwd)){
item.pwd = bCrypt.hashSync(item.pwd,salt) || '';}
console.log(item.pwd+"\n");
},(err) => {
//callback
});
client.close();
})
On the bcrypt-nodejs demo, I am not able to hash a password with the syntax provided:
The error:
is given. Any thoughts on when this can be fixed?