Introduction
In this Blog we will see how to convert string into MD5 in SQL Server. First we will try to understand what MD5 is.
The MD5 message-digest algorithm is a widely used cryptographic hash function producing a 128-bit (16-byte) hash value, typically expressed in text format as a 32 digit hexadecimal number. MD5 has been utilized in a wide variety of cryptographic applications, and is also commonly used to verify data integrity.
Go to SQL Server and write the below SQL Query.
- Select CONVERT(VARCHAR(32), HashBytes('MD5', 'This text is going to be converted to MD5'), 2) as MD5Hash

So the MD5 equivalent of “This text is going to be converted to MD5
” is “4DF5BE7CB28FF963C57D51E6D3CCE042”.
Let’s try out one more examples. Execute the following command.
- Select CONVERT(VARCHAR(32), HashBytes('MD5', 'Sample Text'), 2) as MD5Hash

The MD5 equivalent of “Sample Text” is “83936A3F80BA44C78C9911F5445F2994”.

Shridhar SharmaPosted Mar 20, 2015, 10:45 AM
nice snippet :)
NitinPosted Mar 16, 2015, 7:54 AM
Thanks Nitin Pandit :)
Nitin PanditPosted Mar 16, 2015, 7:47 AM
Nice :)