尝试将密码历史记录与 SqlMembershipProvider 创建的哈希密码进行比较

发布于 2024-10-20 20:29:46 字数 430 浏览 5 评论 0原文

我正在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

空城旧梦 2024-10-27 20:29:46

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

...实现您自己的定制
会员提供者,记录
密码历史记录并加密
密码由您自己设置。

SQLMembershipProvider:比较哈希密码

This post has some good info. Looks like you have to:

...implement your own customized
MembershipProvider, record the
password history and encrypt the
password by your self.

SQLMembershipProvider: Comparing Hashed Passwords

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文