5

我正在使用 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
}

我希望这很清楚,谢谢。

4

1 回答 1

2

这篇文章有一些很好的信息。看起来你必须:

...实现您自己的自定义 MembershipProvider,记录密码历史并自行加密密码。

SQLMembershipProvider:比较散列密码

于 2011-03-08T01:24:05.273 回答