using System.Security.Cryptography;
public static void Main()
string source = "e5aab3bb1ccce41465d7a0574cac48ce79070f64bbbd2868897c18d2c021ce29json{\"id\":\"francis-test@gmail.com\",\"lists\":{\"Morning Wire Subscribers\":1},\"vars\":{\"source\":\"KUB07\",\"first_name\":\"Francis\",\"last_name\":\"Test\"}}";
using (MD5 md5Hash = MD5.Create())
string hash = GetMd5Hash(md5Hash, source);
Console.WriteLine("The MD5 hash of " + source + " is: " + hash + ".");
Console.WriteLine("Verifying the hash...");
if (VerifyMd5Hash(md5Hash, source, hash))
Console.WriteLine("The hashes are the same.");
Console.WriteLine("The hashes are not same.");
static string GetMd5Hash(MD5 md5Hash, string input)
byte[] data = md5Hash.ComputeHash(Encoding.UTF8.GetBytes(input));
StringBuilder sBuilder = new StringBuilder();
for (int i = 0; i < data.Length; i++)
sBuilder.Append(data[i].ToString("x2"));
return sBuilder.ToString();
static bool VerifyMd5Hash(MD5 md5Hash, string input, string hash)
string hashOfInput = GetMd5Hash(md5Hash, input);
StringComparer comparer = StringComparer.OrdinalIgnoreCase;
if (0 == comparer.Compare(hashOfInput, hash))