private void RunHMACExample() { // Hashed Message Authentication Codes Console.WriteLine("Hashed Message Authentication Codes started"); Console.WriteLine(String.Format("Message before Hashing: {0}", _originalMessage)); Console.WriteLine(string.Empty); byte[] keyToUse = CryptographyExample.GenerateKey(); byte[] MD5Hash = CryptographyExample.ComputeMd5HashWithKey(Encoding.UTF8.GetBytes(_originalMessage), keyToUse); Console.WriteLine(String.Format("Message after MD5 Hash: {0}", Convert.ToBase64String(MD5Hash))); byte[] SHA1Hash = CryptographyExample.ComputeSha1HashWithKey(Encoding.UTF8.GetBytes(_originalMessage), keyToUse); Console.WriteLine(String.Format("Message after SHA1 Hash: {0}", Convert.ToBase64String(SHA1Hash))); byte[] SHA2Hash256 = CryptographyExample.ComputeSha2Hash256WithKey(Encoding.UTF8.GetBytes(_originalMessage), keyToUse); Console.WriteLine(String.Format("Message after SHA2 (256) Hash: {0}", Convert.ToBase64String(SHA2Hash256))); byte[] SHA2Hash512 = CryptographyExample.ComputeSha2Hash512WithKey(Encoding.UTF8.GetBytes(_originalMessage), keyToUse); Console.WriteLine(String.Format("Message after SHA2 (512) Hash: {0}", Convert.ToBase64String(SHA2Hash512))); Console.WriteLine(string.Empty); Console.WriteLine("Hashed Message Authentication Codes ended"); }