gpt4 book ai didi

c# - 尝试将密码历史记录与 SqlMembershipProvider 创建的散列密码进行比较

转载 作者:太空狗 更新时间:2023-10-29 23:41:48 25 4
gpt4 key购买 nike

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

我希望这是清楚的,谢谢。

最佳答案

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

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

SQLMembershipProvider: Comparing Hashed Passwords

关于c# - 尝试将密码历史记录与 SqlMembershipProvider 创建的散列密码进行比较,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5223271/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com