加密
// npm install bcryptjs// 之所以没有才有md5加密,是因为 bcryptjs 比md5更安全const password = "123456"const salt = bcrypt.genSaltSync(10)const hash = bcrypt.hashSync(password, salt) // hash就是加密的代码// PS:1. bcrypt 依赖比较多2. node-gyp3. bcryptjs 不需要依赖,比较友好4. npm i bcryptjs
解密
bcrypt.compareSync("用户输入的密码", "数据库中保存的密码")
