📅  最后修改于: 2022-03-11 14:56:42.790000             🧑  作者: Mango
const bcrypt = require ('bcrypt');
const saltRounds = 10;
bcrypt.genSalt(saltRounds, function(err, salt) {
// returns salt
});
// or
bcrypt.genSalt(saltRounds, function(err, salt) {
bcrypt.hash(password, salt, function(err, hash) {
// returns hash
console.log(hash);
});
});