I need your help on implementing an encryption process from C# code to sql server.
Here is the method I get in c# code :
private static string GetPhpMD5(string strPlain)
{
ASCIIEncoding UE = new ASCIIEncoding();
byte[] HashValue, MessageBytes = UE.GetBytes(strPlain);
MD5 md5 = new MD5CryptoServiceProvider();
string strHex = "";
HashValue = md5.ComputeHash(MessageBytes);
foreach(byte b in HashValue)
{
strHex += String.Format("{0:x2}", b);
}
return strHex;
} /* GetPhpMD5 */
GetPhpMD5("nvhG#hdsdsqsd3H");
And so I want to do the same in sql server. I try this but not giving me the same result :
select Hashbytes('MD5', CONVERT(varchar(max),'nvhG#hdsdsqsd3H', 2) )
Result in c# : f4ae6882a7e2aff90d58a29100c5bbf6
Result in sql server : 0xF4AE6882A7E2AFF90D58A29100C5BBF6
Can anyone help me on this please.
Thanks a lot.