public static string MD5(this string input)
{
MD5 md5 = MD5CryptoServiceProvider.Create();
byte[] temp = md5.ComputeHash(Encoding.ASCII.GetBytes(input));
string byte2String = null;
for (int i = 0; i < temp.Length; i++)
{
byte2String += temp[i].ToString("x2");
}
return byte2String;
}
{
MD5 md5 = MD5CryptoServiceProvider.Create();
byte[] temp = md5.ComputeHash(Encoding.ASCII.GetBytes(input));
string byte2String = null;
for (int i = 0; i < temp.Length; i++)
{
byte2String += temp[i].ToString("x2");
}
return byte2String;
}
看到x2了吗?好多人是ToString("x")结果就会少位了。