using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Security.Cryptography;
namespace Login
{
class Md5create
{
public static string getMd5Hash(string str)
{
MD5 md5 = MD5.Create();
string strNew="";
byte[] buffer = Encoding.Default.GetBytes(str); //字符串转字节数组
byte[] md5buffer = md5.ComputeHash(buffer); //字节数组哈希函数
foreach (byte i in md5buffer) //字节数组转字符串
{
strNew += i.ToString("x2"); //定义模式(不去零)
}
return strNew;
}
}
}
MD5与SHA-512加密C#实现
最新推荐文章于 2022-04-08 17:33:04 发布