【发布时间】:2012-10-12 23:12:29
【问题描述】:
来自github:
散列密码:
var bcrypt = require('bcrypt');
bcrypt.genSalt(10, function(err, salt) {
bcrypt.hash("B4c0/\/", salt, function(err, hash) {
// Store hash in your password DB.
});
});
检查密码:
// Load hash from your password DB.
bcrypt.compare("B4c0/\/", hash, function(err, res) {
// res == true
});
bcrypt.compare("not_bacon", hash, function(err, res) {
// res = false
});
从上面看,比较中怎么可能没有盐值?我在这里错过了什么?
【问题讨论】: