Net MD5

using System.Security.Cryptography;

        /// <summary>
        /// MD5散列
        /// </summary>
        public static string MD5(this string inputStr)
        {
            MD5 md5 = new MD5CryptoServiceProvider();
            byte[] hashByte = md5.ComputeHash(Encoding.UTF8.GetBytes(inputStr));
            StringBuilder sb = new StringBuilder();
            foreach (byte item in hashByte)
                sb.Append(item.ToString("x").PadLeft(2, '0'));
            return sb.ToString();
        }

 

posted @ 2021-11-11 10:46  Robot-Blog  阅读(44)  评论(0编辑  收藏  举报