首页 > Linux操作系统 > Linux操作系统 > DotNet-MD5
using
System;using
System.Text;using
System.Security.Cryptography;namespace
{
My.Encryptor///{
{
public class MD5public MD5()// // TODO: Add constructor logic here //}
{
MD5CryptoServiceProvider md5Hasher =
UTF8Encoding encoder =
Byte[] hashedBytes = md5Hasher.ComputeHash(encoder.GetBytes(toEncode));
}
{
StringBuilder buff =
{
buff.Append(String.Format("{0:X2}", hashByte));
}
}
}
}
public static string Encode(string toEncode)new MD5CryptoServiceProvider();new UTF8Encoding();return ByteToHash(hashedBytes);private static string ByteToHash(Byte[] byteToHash)new StringBuilder();foreach (byte hashByte in byteToHash)return buff.ToString();来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/12476590/viewspace-134140/ ,如需转载,请注明出处,否则将追究法律责任。