#region MD5加密
/// <summary>
/// MD5加密
/// </summary>
/// <param name="strPwd"></param>
/// <returns></returns>
public string Encrypt(string strPwd)
{
String str = "";
// 初始化MD5对象
MD5 md5 = new MD5CryptoServiceProvider();
// 将字符编码为一个字节数组
byte[] data = Encoding.Default.GetBytes(strPwd);
// 计算data字节数组的哈希值
byte[] md5Data = md5.ComputeHash(data);
// 清空md5
md5.Clear();
// 遍历md5Data哈希数组
for (int i = 0; i < md5Data.Length - 1; i++)
{
str += md5Data[i].ToString("x").PadLeft(2, '0');
}
return str;
}
#endregion