是一样的
C# 取中间16位,与ASP相同
public static string Md5(string inputString)
{
MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
byte[] encryptedBytes = md5.ComputeHash(Encoding.ASCII.GetBytes(inputString));
StringBuilder sb = new StringBuilder();
for (int i = 0; i < encryptedBytes.Length; i++)
{
sb.AppendFormat("{0:x2}", encryptedBytes[i]);
}
return sb.ToString().Substring(8, 16);
}
是因为字符的编码不一样改成一样的编码就行了,看看这吧
http://zhidao.baidu.com/question/103185401.html