0

I'd would like to encrypt in a database the password by using SHA-256 algorithm. I have made some researches and I found out I should use MessageDigestclass to encrypt properly a string object. The problem is how should revert the hash function to get back to the original password? I mean If I would create a login system, I have to be able to get back to the original password or maybe not? Maybe when the password is filled into the form, it has to be converted into hash function and compared to the hash string stored in database, right?

1

1 Answer 1

5

Brother, the entire purpose of hashes is that you should not be able to get the original string back from them. What you need to do in case of passwords is you hash the user input and compare it with the hash of the password to check if it was the original password. To know how you convert the password into a SHA-256 hash read this.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you Adbul Fatir. I asked it only to be safer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.