using System; using System.Collections.Generic; using System.Linq; using System.Security.Cryptography; using System.Text; using System.Threading.Tasks; namespace Inotify.Common { public static class Extensions { /// /// MD5加密字符串(32位大写) /// /// 源字符串 /// 加密后的字符串 public static string ToMd5(this string source) { MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider(); byte[] bytes = Encoding.UTF8.GetBytes(source); string result = BitConverter.ToString(md5.ComputeHash(bytes)); return result.Replace("-", ""); } } }