public static string Encrypt(this string str, string key = "h%12D;](6")
{
var md5 = MD5.Create();
// 计算字符串的散列值
var bytes = md5.ComputeHash(Encoding.UTF8.GetBytes(str));
var eKey = new StringBuilder();
foreach (var item in bytes)
{
eKey.Append(item.ToString("x"));
}
// 字符串散列值+密钥再次计算散列值
bytes = md5.ComputeHash(Encoding.UTF8.GetBytes(key + eKey));
var pwd = new StringBuilder();
foreach (var item in bytes)
{
pwd.Append(item.ToString("x"));
}
return pwd.ToString();
}