C# MD5加密

/// <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();
}

C# MD5加密

上一篇:# [Acwing 1027] 方格取数(三维DP)


下一篇:Golang调用windows下的dll动态库中的函数