You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
714 B
25 lines
714 B
using System.Security.Cryptography;
|
|
using System.Text;
|
|
|
|
namespace System
|
|
{
|
|
internal static class StringMd5Extensions
|
|
{
|
|
public static string ToMd5(this string str)
|
|
{
|
|
using (MD5 mD = MD5.Create())
|
|
{
|
|
byte[] bytes = Encoding.UTF8.GetBytes(str);
|
|
byte[] array = mD.ComputeHash(bytes);
|
|
StringBuilder stringBuilder = new StringBuilder();
|
|
byte[] array2 = array;
|
|
foreach (byte b in array2)
|
|
{
|
|
stringBuilder.Append(b.ToString("X2"));
|
|
}
|
|
|
|
return stringBuilder.ToString();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|