📌  相关文章
📜  如何在节点 js 中对密码进行哈希处理 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:12.734000             🧑  作者: Mango

代码示例1
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);