using System.Text

using System.Security.Cryptography;

 

string md5string=“123456”;

MD5 md5 = new MD5CryptoServiceProvider();
byte[] bytes1 = Encoding.UTF8.GetBytes(md5string);
byte[] bytes2 = md5.ComputeHash(bytes1);
string md5result = "";
for (int i = 0; i < bytes2.Length; i++)
{
md5result += bytes2[i].ToString("x2");
}

Console.WriteLine(md5result );

这里的结果为

 

Posted on 2023-03-01 23:04  lt柱  阅读(18)  评论(0)    收藏  举报