怎样让Webform 和Winform MD5加密得到同一个MD5值(webform和winform的MD5加密方式不同)
Winform
public static string StringToMD5Hash(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();
}
Webform
public static string md5(string pwd)
{
string md5pwd = FormsAuthentication.HashPasswordForStoringInConfigFile(pwd, "MD5");
return md5pwd;
}
以上两种如果操作相同的数据表,可以得到相同的MD5值(都是32位)