C# MD5加密字符串
2021-03-01 21:25
标签:compute code style put hash byte ret coding class C# MD5加密字符串 标签:compute code style put hash byte ret coding class 原文地址:https://www.cnblogs.com/PinkMi/p/14258167.html public string GetMD5(string txt)
{
System.Security.Cryptography.MD5 md5 = new System.Security.Cryptography.MD5CryptoServiceProvider();
byte[] frmData = System.Text.Encoding.UTF8.GetBytes(txt);
byte[] targetData = md5.ComputeHash(frmData);
string str = null;
for (int i = 0; i )
{
str = str + targetData[i].ToString("x2");
}
return str;
}