Answers for "how to hash password in node js"

2

how to hash password in node js

npm i bcrypt

const bcrypt = require('bcrypt');
async function hashIt(password){
  const salt = await bcrypt.genSalt(6);
  const hashed = await bcrypt.hash(password, salt);
}
hashIt(password);
// compare the password user entered with hashed pass.
async function compareIt(password){
  const validPassword = await bcrypt.compare(password, hashedPassword);
}
compareIt(password);
Posted by: Guest on October-02-2020

Code answers related to "how to hash password in node js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language