29 lines
689 B
C#
29 lines
689 B
C#
using System;
|
|||
|
|
using System.Collections.Generic;
|
||
|
|
using System.IO;
|
||
|
|
using System.Linq;
|
||
|
|
using System.Security.Cryptography;
|
||
|
|
using System.Text;
|
||
|
|
using System.Threading.Tasks;
|
||
|
|
|
||
|
|
namespace Common.Utils
|
||
|
|
{
|
||
|
|
public static class Md5Helper
|
||
|
|
{
|
||
|
|
public static string GetMD5(string str)
|
||
|
|
{
|
||
|
|
byte[] sor = Encoding.UTF8.GetBytes(str);
|
||
|
|
MD5 md5 = MD5.Create();
|
||
|
|
byte[] result = md5.ComputeHash(sor);
|
||
|
|
StringBuilder strbul = new StringBuilder(40);
|
||
|
|
for (int i = 0; i < result.Length; i++)
|
||
|
|
{
|
||
|
|
strbul.Append(result[i].ToString("x2"));
|
||
|
|
|
||
|
|
}
|
||
|
|
return strbul.ToString();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|