代码:
using System;using System.Collections.Generic;using System.Linq;using System.Security.Cryptography;using System.Text;using System.Threading.Tasks;namespace MessageReminder.Utils{ ////// MD5加密 /// public class MD5Helper { ////// MD5加密 /// /// 原文 public static string Encrypt(string text) { MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider(); byte[] bArr = md5.ComputeHash(ASCIIEncoding.ASCII.GetBytes(text)); StringBuilder sb = new StringBuilder(); foreach (byte b in bArr) { sb.Append(b.ToString("x2")); } return sb.ToString(); } }}