|
-
Jun 10th, 2024, 07:33 AM
#7
Re: Hashing Mysql example MySQL gives you. Like to know how its used
 Originally Posted by sdowney1
You can see why I am wondering if this is still some kind of hashing
It mentions SHA2 in set command
mysql> SET @key_str = SHA2('My secret passphrase',512);
And like it says here SHA2 is for hashing. Can you use SHA2 and it not be hashing?
https://www.comparitech.com/blog/inf...-does-it-work/
The SHA-2 family of hashing algorithms are the most common hash functions in use. SHA-256 is particularly widespread. These hash functions are often involved in the underlying security mechanisms that help to protect our daily lives. You may have never noticed it, but SHA-2 is everywhere.
To begin with, SHA-2 is involved in many of the security protocols that help to protect much of our technology:
SHA2 is a hash function, that will return a hash of the string 'My secret passphrase', once that function has returned @key_str will contain the hash of the secret phrase. A hash is a one way trip, you cannot un-hash something to get the original data back.
If you wanted to store a password (or pass phrase) you would take the hash of the password (often combined with a salt) and store the hash. That is all you would need to do. Hash the password and store the hash.
The AES_ENCRYPT function is an encryption routine, it will generate an encrypted result that can later be decrypted back to the original data.
The example from the documentation is taking a user supplied password, generating a hash from the password and then using the hash to encrypt the text, this resulting encrypted text could then be decrypted using the hash of the original password.
If you want to store a password however, don't encrypt it - just hash it and store the hash.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|