在线文档编辑修改

This commit is contained in:
2024-11-20 18:48:45 +08:00
parent 8a39c901d4
commit b8941a01d7
4 changed files with 95 additions and 70 deletions
+20
View File
@@ -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();
}
}
}
}