how to extract data from hashbyte text after hash or encrypted on sql server 2017 ?
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
i hash my text as below
select HASHBYTES('SHA2_512','username:sayed password:321')
how to get text
username:sayed password:321
from hashed below
0x11AF8281C1FB70097586CDCA6A9B2CA35BCC464CCD4F57D3C1D347371EB8433015080669AE93141D8A170822BB803CC36015841ED3BA853D322201C4A25F9E8D
Jochen BartlauPosted May 9, 2022, 11:43 AM
You can't. A hash is a non reversible way to transform a large, random sized data entity to a short, fixed representation, this is the very purpose of such a function. You can only use it to verify an information hasn't changed, or to e.g. validate a password. However, you'd always recalculate the hash with the given user input and compare it to the value stored in the database. You can never use the hash to reconstruct the hashed data directly.