so after hashing by using hashbyte i need to extract data from it
Hashbyte is use to compare data content, but you can not extract anything from a hash value.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I work on sql server 2017 i have field nvarchar(max) store values hashbytes
suppose i have text as username:sayed password:321
and i hash it by using hashbyte
so after hashing by using hashbyte
i need to extract data from it
meaning i need to get data of user as
username:sayed password:321
so how to extract data from field hashed by using hashbyte sql server 2017
meaning
How to get data password:321
so after hashing by using hashbyte i need to extract data from it
Hashbyte is use to compare data content, but you can not extract anything from a hash value.
Write loops that generate passwords, compute hashbytes and compare with the stored hashbytes. Wait for matches. One of the results will be “sayed, 321”.
Hi @ahmed salah
I gonna say 'No', as far as i known, there is no such function to convert Hashbyte back to string.
The purpose of computing a hash value is never to be able to re-construct the data, as it's utility as a security mechanism would drop to zero.
By the way,if you have something like TableB with a column containing a hash of columns from TableA. You could join rows in TableB back to the related row in TableA. Like this:
SELECT B.HashID, A.*
FROM TableA A JOIN TableB B ON B.HashID = HASHBYTES ('SHA2_512', A.Column );
Best regards,
LiHong
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our Documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Hi @ahmed salah
Maybe you need this: ENCRYPTBYPASSPHRASE and DECRYPTBYPASSPHRASE
Check this sample:
declare @encrypt varbinary(200)
select @encrypt = EncryptByPassPhrase('key', 'password:321' )
select @encrypt
select convert(varchar(100),DecryptByPassPhrase('key', @encrypt ))
Best regards,
LiHong
A "hash" is not reversible. You cannot get the original value back and you don't want too.
In your case, you would hash the password in your app and store the hashed value in the database. Then you hash the user input and compare it to the stored hashed value. That way you never need to know the actual password.