using System.Security.Cryptography; using System.Text; namespace Bunny.Common.Utils.Net; public static partial class NetUtil { /// /// MD5 加密32位-大写 /// /// 密码 /// 加密后结果 public static string Encryption32(string password) { var md5 = new MD5CryptoServiceProvider(); var bytes = Encoding.UTF8.GetBytes(password); var result = BitConverter.ToString(md5.ComputeHash(bytes)); return result.Replace("-", ""); } /// /// md5 加密32位-小写 /// /// 密码 /// 加密后结果 public static string Encryption32Lower(string password) { var md5 = new MD5CryptoServiceProvider(); var bytes = Encoding.UTF8.GetBytes(password); var result = BitConverter.ToString(md5.ComputeHash(bytes)); return result.Replace("-", "").ToLower(); } }