我正在使用 SqlMembershipProvider 并将我的密码存储为散列。我还在另一个表中保留了(散列)密码的历史记录。我希望能够将用户尝试将密码更改为的密码与旧密码进行比较,如果密码太新则抛出错误。我似乎无法弄清楚如何使用散列函数来做到这一点。基本上我正在寻找的是这样的方法:
public bool PasswordCompare(string plaintextPassword, string salt, string hashedPassword)
{
//where the salt and hashedPassword are pulled out of the aspnet_Membership table
//which are automatically generated by the provider
}
我希望这很清楚,谢谢。