标签:
引用:
using System.Security.Cryptography;
类:
public class MD5Util
{
public static string GetMD5(string input)
{
return GetMD5(input, Encoding.Default);
}
public static string GetMD5(string input, Encoding encoding)
{
using (MD5 md5Hash = MD5.Create())
{
byte[] data = md5Hash.ComputeHash(encoding.GetBytes(input));
StringBuilder sb = new StringBuilder();
for (int i = 0; i < data.Length; i++)
{
sb.Append(data[i].ToString("x2"));
}
return sb.ToString();
}
}
}
标签:
原文地址:http://www.cnblogs.com/xsj1989/p/4707427.html