bcrypt nodejs hash password
bcrypt.genSalt(saltRounds, (err, salt) => {
bcrypt.hash(yourPassword, salt, (err, hash) => {
console.log(salt + hash)
});
});
bcrypt nodejs hash password
bcrypt.genSalt(saltRounds, (err, salt) => {
bcrypt.hash(yourPassword, salt, (err, hash) => {
console.log(salt + hash)
});
});
bcrypt compare hash and password
var bcrypt = dcodeIO.bcrypt;
/** One way, can't decrypt but can compare */
var salt = bcrypt.genSaltSync(10);
/** Encrypt password */
bcrypt.hash('anypassword', salt, (err, res) => {
console.log('hash', res)
hash = res
compare(hash)
});
/** Compare stored password with new encrypted password */
function compare(encrypted) {
bcrypt.compare('aboveusedpassword', encrypted, (err, res) => {
// res == true or res == false
console.log('Compared result', res, hash)
})
}
// If u want do the same with NodeJS use this:
/* var bcrypt = require('bcryptjs') */
bcrypt always return faslse in node js
first thing make sure to increase the length(must be greater than 60/70) in database and then checkout
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us