de2bd2f9
“wangming”
项目初始化
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
using System;
using System.Text;
namespace NCC.Core.Pay.Security
{
public static class MD5
{
public static string Compute(string data)
{
if (string.IsNullOrEmpty(data))
{
throw new ArgumentNullException(nameof(data));
}
using (var md5 = System.Security.Cryptography.MD5.Create())
{
var hash = md5.ComputeHash(Encoding.UTF8.GetBytes(data));
#if NET5_0_OR_GREATER
return Convert.ToHexString(hash);
#else
return BitConverter.ToString(hash).Replace("-", "");
#endif
}
}
}
}
|