其他分享
首页 > 其他分享> > MD5加密32位16进制

MD5加密32位16进制

作者:互联网

 public static string UseMd5(string str)
        {
           using (MD5 mi = MD5.Create())
            {
                byte[] buffer = Encoding.Default.GetBytes(str.Trim());
                //开始加密
                byte[] newBuffer = mi.ComputeHash(buffer);
                StringBuilder sb = new StringBuilder();
                for (int i = 0; i < newBuffer.Length; i++)
                {
                    sb.Append(newBuffer[i].ToString("x2"));
                }
                return sb.ToString();
            }
        }

 

标签:string,16,buffer,32,newBuffer,StringBuilder,sb,MD5
来源: https://www.cnblogs.com/lunawzh/p/14939679.html