为什么我的bcrypt授权总是返回true

时间:2014-03-27 00:14:29

标签: python bcrypt

我在python上设置了一个简单的bcrpyt授权。无论密码是什么,哈希都会每次都匹配。我不能为我的生活弄清楚为什么会这样做。

我为我的生活无法理解为什么会这样做。

if bcrypt.hashpw(password, user.password) == user.password:
    uj = user_json(str(user.user_id), user.email, user.firstname, user.lastname, user.state, user.city)
    self.write(uj)
else:
    self.write(error_json(cna="cannot authorize user"))

无论我输入的密码如何。哈希总是返回匹配的东西。

0 个答案:

没有答案