#region MD5加密
///<summary>
///给一个字符串进行MD5加密
///</summary>
///<param name="strText">待加密字符串</param>
///<returns>加密后的字符串</returns>
public static string MD5Encrypt(string strText)
{
MD5 md5 = new MD5CryptoServiceProvider();
byte[] result = md5.ComputeHash(System.Text.Encoding.UTF8.GetBytes(strText));//用到UTF8
md5.Clear();
string ret = "";
for (int i = 0; i < result.Length; i++)
{
ret += Convert.ToString(result[i], 16).PadLeft(2, '0');//这一步非常关键
}
return ret.PadLeft(32, '0').ToUpper();
}
#endregion