Hello,
Do you know how to mimic PHP md5 function? I'm using followin function,
but the results are different with PHP result when using Unicode (UTF-8)
characters. Someone please help me fix this...
Try compare PHP's result and following function result with this string
"Tiếng Việt"
PS: Hope you can read the string, this mail is in UTF-8.
------------------------------------------------------------
public static string Hash(string String)
{
byte[] buffer = System.Text.Encoding.Default.GetBytes(String);
try
{
System.Security.Cryptography.MD5CryptoServiceProvi der Check;
Check = new System.Security.Cryptography.MD5CryptoServiceProvi der();
byte[] Hash = Check.ComputeHash(buffer);
string HashString = "";
foreach (byte a in Hash)
{
if (a < 16)
{
HashString += "0" + a.ToString("X");
}
else
{
HashString += a.ToString("X");
}
}
return HashString.ToLower();
}
catch
{
throw;
}
}
------------------------------------------------------------