记住不要忘记命名空间的引用:
using System.Security.Cryptography;
public string PwdEncrypt(string pwd) // MD5加密密码.....
{
MD5 md5 = new MD5CryptoServiceProvider();
byte[] data = System.Text.Encoding.Default.GetBytes(pwd);
byte[] md5data = md5.ComputeHash(data);
md5.Clear();
string Str = "";
for (int i = 0; i < md5data.Length - 1; i++)
{
Str += md5data[i].ToString("x").PadLeft(2, '0');
}
return Str;
}
如对本文有疑问,请提交到交流论坛,广大热心网友会为你解答!! 点击进入论坛