Trying to reproduce PHP's pack(“H*”) function in C#
问题 this is my code in C# : public static String MD5Encrypt(String str, Boolean raw_output=false) { // Use input string to calculate MD5 hash String output; MD5 md5 = System.Security.Cryptography.MD5.Create(); byte[] inputBytes = System.Text.Encoding.ASCII.GetBytes(str); byte[] hashBytes = md5.ComputeHash(inputBytes); // Convert the byte array to hexadecimal string StringBuilder sb = new StringBuilder(); for (int i = 0; i < hashBytes.Length; i++) { sb.Append(hashBytes[i].ToString("x2")); } output