Encrypt application name in c# and decrypt in SQL Server

encryption

I've encrypted application name in my c# app using MD5, so when constructing the connection string the application name is passed to SQL as encrypted. I would like to decrypt in SQL server the value to see if there is a match?
How can I get the original text in SQL ?

Best Answer

Hashes like MD5 are by definition one-way: you can't decrypt them by design. This is how many applications store secrets like passwords. A better solution would be to store a list of applications and their hashed values in a database table, then compare your submitted hash to the stored hashes to find a match.