r/learnjava • • Dec 29 '20

How do I validate the login details when the password is Hashed?

I can validate it without the hashing by comparing the values with the ones in the database but I'm baffled as to how I do it when the password is hashed. I have a table called hashedPasswords that has the userName, seed & hash. How would I validate in this way?

0 Upvotes

2 comments sorted by

8

u/mainmeister Dec 29 '20

Prompt the user for the password. Take the password entered and hash it. Compare that hash to the one stored in the database.

2

u/imaginedoe Dec 29 '20

use the same process that you used to create the hash. then, compare the new hash to the actual hash.