문제

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.

도움이 되었습니까?

해결책

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/

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top