Reputation: 2188
I have a column for storing passwords in a SQL Server database table, where all the data is encrypted like this:
25-4B-F1-CB-2C-12-85-EB-17-2E-36-C0-B4-01-2C-28
How can I decrypt this data into a readable form? I'm using SQL Server 2012. I need this help badly & your help would be reaally appreciated. Thanks
Upvotes: 0
Views: 3699
Reputation: 26846
This looks like an output of md5
hash function where each byte is converted to hex string and separated by dashes. Output of md5 is 128 bit and here is exactly 16 bytes of data. sha-1
and sha-2
hash functions produces larger outputs so it is unlikely to be that functions.
You can't decrypt it, as by design md5 if non-invertible function.
But if these data are actually some hashed passwords - you are still able to use these passwords to authenticate your users.
All you need - get plain text password from user, compute md5 hash of it using TSQL HashBytes function, convert it byte-by-byte to your saved format (hex string separated by dashes) and compare to your saved value. Or, of course - you can preliminary transform that saved values back to varbinary and save in another column and compare that varbinaries with output of md5 - it's up to you.
Upvotes: 1