How to create a mysql "sha-256" column?
19,385
You can convert the value to hex and use a char(n) column with the appropriate length - 64 in this case. The conversion can be done in MySQL by using the sha2
function with hash_length
set to 256.
But for security reasons you should not store passwords hashed using SHA-256.
Related
Author by
Daemonthread
Updated on June 12, 2022Comments
-
Daemonthread almost 2 years
For a password column, is there a mysql feature to store password hashed with "sha-256"? Or should I hash it from java code (like How to hash some string with sha256 in Java? ) before I store it in database and then hash the password input every time and compare with the database column value to authenticate?
TIA.