ASP.NET CORE中使用MD5加密

96
niunan
2017.02.26 11:39* 字数 9
   /// <summary>
    /// netcore下的实现MD5加密
    /// </summary>
    /// <param name="str"></param>
    /// <returns></returns>
    public static string MD5Hash(string input)
    {
        using (var md5 = MD5.Create())
        {
            var result = md5.ComputeHash(Encoding.ASCII.GetBytes(input));
            var strResult = BitConverter.ToString(result);
            return strResult.Replace("-", "");
        }
    }

记得要引入using System.Security.Cryptography;

日记本
Web note ad 1