尝试将密码历史记录与 SqlMembershipProvider 创建的哈希密码进行比较
我正在使用 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
}
我希望这是清楚的,谢谢。
I am using a SqlMembershipProvider and storing my passwords as hashed. I am also keeping a history of the (hashed) passwords in another table. I want to be able to compare the password a user tries to change their password to, to their old passwords and throw an error if it was too recent. I do not seem to be able to figure out how to use the hashing functions to do this. Basically what I am looking for is a method like this:
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
}
I hope this is clear, thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这篇文章有一些很好的信息。看起来你必须:
SQLMembershipProvider:比较哈希密码
This post has some good info. Looks like you have to:
SQLMembershipProvider: Comparing Hashed Passwords