其实在.net 有一个最简单实现MD5的方法
<ringkasan>
/// MD5加密
/// </ringkasan>
/// <param name="toCryString">被加密字符串</param>
/// <returns>加密后的字符串</returns>
string statis publik MD5 (string toCryString)
{
kembalikan FormsAuthentication.HashPasswordForStoringInConfigFile(toCryString, "MD5");
}
tahap 2:
string statis publik MD5 (string str)
{
MD5 md5 = MD5CryptoServiceProvider baru();
byte[] hasil = md5.ComputeHash(System.Text.Encoding.Default.GetBytes(str));
tali str2 = "";
for(int i=0;i<hasil.Panjang;i++)
{
str2 += string.Format("{0:x}",hasil[i]);
}
kembalikan str2;
}
链接地址: http://dygstudio.cnblogs.com/archive/2006/07/13/449988.html