You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
634 B
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using System.Security.Cryptography;
using System.Text;
namespace DS.Module.Core.Helpers;
/// <summary>
///
/// </summary>
public class MD5Helper
{
/// <summary>
/// MD5加密字符串32位大写
/// </summary>
/// <param name="source">源字符串</param>
/// <returns>加密后的字符串</returns>
public static string MD5Encrypt(string source)
{
MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
byte[] bytes = Encoding.UTF8.GetBytes(source);
string result = BitConverter.ToString(md5.ComputeHash(bytes));
return result.Replace("-", "");
}
}