bcrypt 加密
bcrypt 加密
引入
npm i bcrypt -S
代码
加密
const bcrypt = require("bcrypt")
const salt = bcrypt.genSaltSync(10);
const hash = bcrypt.hashSync(password, salt);//加密
验证
const isMatch = bcrypt.compareSync(password, hash);//验证
本文来自博客园,作者:流云君,转载请注明原文链接:https://www.cnblogs.com/yun10011/p/17395667.html