1.) Storing database passwords Use some kind of hash with salt, and then change the hash, obfuscate it, for example, add a clear value for each byte. Thus, your passwords are super protected from dictionary attacks and rainbow tables.
2.) To check if the password matches, create a hash for the user-entered password. Then query the database for the username and just check if the two password hashes are identical. If so, give the user an authentication token.
The request should look like this:
select hashedPassword from users where username=?
Then compare the password with the input.
Any other questions?
source
share