Decode of Varbinary column value

We are trying to convert varbinary column values to a readable text using convert and cast but it return unreadable characters. Any help is appreciated.

used HASHBYTES('MD5',Columns) to get varbinary value but i am trying read the varbinary to Text i am getting Unreadable characters.

HASHBYTES is not a char-for-char encryption. Afaik, you won't be able to get the original text back from a HASHBYTES value.

2 Likes

I think you are confused hashing with encryption. Encryption is reversable while hashing is not

1 Like

Thank you for responding. The existing code is already pre-written, and the checksum value from the previous version differs from the current one. I would like to ascertain the text values from both the previous and current versions. is there any other way to check the text values.

You would have to generate text values, then use the same checksum or hash function on that generated text, and then compare its hash/checksum value to something in your table. As mentioned earlier, hash functions are not reversible.

Also, it's possible for 2 different text strings to hash to the same value, which is known as a hash collision. The intent of hash/checksums is to detect if something has changed, but doesn't specifically identify what has changed.

1 Like