C# MD5加密
程序员文章站
2024-03-19 22:06:28
...
/// <summary>
/// MD5加密
/// </summary>
/// <param name="strText">待加密字符串</param>
/// <returns>加密后字符串</returns>
public static string MD5Encrypt(string strText)
{
MD5 md5 = new MD5CryptoServiceProvider();
byte[] targetData = md5.ComputeHash(Encoding.UTF8.GetBytes(strText));
string byte2String = null;
for (int i = 0; i < targetData.Length; i++)
{
byte2String += targetData[i].ToString("x2");
}
return byte2String.ToUpper();
}
上一篇: phxpaxos编译 完整流程