在线文档编辑修改
This commit is contained in:
@@ -10,6 +10,7 @@ namespace BLL
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
/// <summary>
|
||||
@@ -1281,6 +1282,25 @@ namespace BLL
|
||||
IRestResponse response = client.Execute(request);
|
||||
return response.Content;
|
||||
}
|
||||
public static string GetMD5(string str)
|
||||
{
|
||||
using (MD5 md5 = MD5.Create())
|
||||
{
|
||||
// 将输入字符串转换为字节数组并计算哈希值
|
||||
byte[] inputBytes = Encoding.ASCII.GetBytes(str);
|
||||
byte[] hashBytes = md5.ComputeHash(inputBytes);
|
||||
|
||||
// 将字节数组转换为十六进制字符串
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < hashBytes.Length; i++)
|
||||
{
|
||||
sb.Append(hashBytes[i].ToString("X2"));
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user