还可以加盐,更难以破解 public static string GetMD5(string sDataIn)
{
MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
byte[] btvalue, bthach;
btvalue = System.Text.Encoding.UTF8.GetBytes(sDataIn);
bthach = md5.ComputeHash(btvalue);
md5.Clear();
string sTemp = "";
for (int i = 0; i < bthach.Length; i++)
{
sTemp += bthach[i].ToString("X").PadLeft(2, '0');
}
return sTemp.ToLower();
}