I'm trying to convert String to md5 that what i did :
public static string MD5Hash(string input)
{
StringBuilder hash = new StringBuilder();
MD5CryptoServiceProvider md5provider = new MD5CryptoServiceProvider();
byte[] bytes = md5provider.ComputeHash(new UTF8Encoding().GetBytes(input));
for (int i = 0; i < bytes.Length; i++)
{
hash.Append(bytes[i].ToString("x2"));
}
return hash.ToString();
}
The code above whene i tested in MD5Hash("MyCode") its returned : 6403df8223bf310152ad235731e79902 (32 char)
but the md5 on my database is 0x6403DF8223BF310152AD235731E79902000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 (64 char)
it's missing the "0X" in the begginig and the "zeros" in the ending