1234567891011121314151617181920212223242526 |
- using System;
- using System.Collections.Generic;
- using System.Security.Cryptography;
- using System.Text;
- namespace ProductionLineMonitor.Core.Utils
- {
- public static class MD5Helper
- {
- /// <summary>
- /// 字符串加密
- /// </summary>
- /// <param name="str">字符串</param>
- /// <returns></returns>
- public static string To32MD5(this string str)
- {
- string rev = "";
- MD5 md5 = MD5.Create();
- byte[] buffer = Encoding.UTF8.GetBytes(str);
- byte[] MD5Buffer = md5.ComputeHash(buffer);
- foreach (var item in MD5Buffer)
- rev += item.ToString("X2");
- return rev;
- }
- }
- }
|