Skip to content
Advertisement

Java encryption with sha256 and salt

I need a little help from you, I have an exercise , to do a login program and to store the password with sha-256 and salt, I made a part, but here it’s the hard part. I’ve read that if you use sha-256 that you can’t reverse the operation to determine the password. If it’s true then what I need to use to encrypt the password and after I encrypt the password, how can I login if the password is encrypted? PS: I’ve searched on google.

Advertisement

Answer

Let’s assume your password is 12345678. You are going to hash this password and save it to you program. In your login program you take the input from the user, hash it with the same algorithm and then compare the two hashed strings. If the are equal, the strings are equal, if not, they aren’t equal. The person cannot figure out what the correct password is and you have hashed your password.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement