1

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.

4

1 に答える 1

3

ここに答えのヒントがあります。詳細については、リンクをたどることができます。

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/

于 2014-03-20T06:41:19.057 に答える