Click here to Skip to main content
15,867,765 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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

What I have tried:

select HASHBYTES('SHA2_512','username:sayed password:321')


how to get text
username:sayed password:321
from hashed below
0x11AF8281C1FB70097586CDCA6A9B2CA35BCC464CCD4F57D3C1D347371EB8433015080669AE93141D8A170822BB803CC36015841ED3BA853D322201C4A25F9E8D
Posted
Updated 9-May-22 1:41am
Comments
CHill60 9-May-22 7:10am    
Why do you need to do this? The whole point of hashing is that you can't unhash
ahmed_sa 9-May-22 7:17am    
how to get data from
0x11AF8281C1FB70097586CDCA6A9B2CA35BCC464CCD4F57D3C1D347371EB8433015080669AE93141D8A170822BB803CC36015841ED3BA853D322201C4A25F9E8D
CHill60 9-May-22 7:19am    
You have already said that bit. My question is WHY not how. Hashing is not meant to be reversed
ahmed_sa 9-May-22 7:21am    
so are possible to get text data from
0x11AF8281C1FB70097586CDCA6A9B2CA35BCC464CCD4F57D3C1D347371EB8433015080669AE93141D8A170822BB803CC36015841ED3BA853D322201C4A25F9E8D
Richard MacCutchan 9-May-22 7:24am    
No, it is not possible. Hashing is one way only.

I suspect what you are trying to do is compare a password entered by a user with a password stored on the database. That is the wrong way around. Hash the entered value and compare the hashed values

See Password Storage: How to do it.[^]
 
Share this answer
 
You can't - that's the whole idea.
A Hash code (like MD5 or SHA) is not encryption: it can't be reversed: Decrypting MD5 and SHA: Why You Can't Do It[^] - this applies to all hashing algorithms.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900