I am hashing password together with a user login and saving it in the database as VARBINARY 20 bytes long.
Now, I am trying to build Login page in asp.net. How can I source the password value from database to compare it with the one provided by the user? I use SqlDataReader to read the database.
Regards,
Bartosz
You don’t unhash the database password and compare it to the input.
You hash the input and compare it to the password. If the two hashes match, you assume it’s the same password1.
1Technically, depending on your hash function, it might not be, as the user could have randomly entered a password which hashes to the same value as the real password, but that’s being pedantic 😉