问题
How do I check if a user entered password matches a password that has been hashed and stored into a database by somebody else. Normally you would use this right?:
bool value = BCryptHelper.CheckPassword("Tom123", passwordHash);
So what if you don't have the passwordHash variable which contains the hashed password?
I don't have a great understanding of how BCrypt works so I think I am missing something very simple.
回答1:
Here is a hint to the answer. You can follow the link for further detailed information.
string salt = BCryptHelper.GenerateSalt(6);
var passwordHash= BCryptHelper.HashPassword("Tom123", salt);
bool value = BCryptHelper.CheckPassword("Tom123", passwordHash);
http://www.dreamincode.net/forums/blog/1267/entry-3301-c%23-using-bcrypt-in-a-net-application-why-its-better-than-sha-or-md5/
来源:https://stackoverflow.com/questions/22525091/how-to-verify-a-password-using-bcrypt