首页 > 代码库 > C# MD5

C# MD5

            private static string GetMd5String(string msg)
            {
                StringBuilder sb = new StringBuilder();
                using(MD5 md5 = MD5.Create())
                {
                    byte[] bytes = Encoding.UTF8.GetBytes(msg);

                    byte[] md5Byte = md5.ComputeHash(bytes);

                    for (int i = 0; i < md5Byte.Length; i++)
                    {
                        sb.Append(md5Byte[i].ToString("x2"));
                    }
                }
                return sb.ToString();
            }

  



C# MD5