/// <summary> /// These appear to be working - get the same results a wikipedia http://en.wikipedia.org/wiki/HMAC /// </summary> public static void TestHMACs() { byte[] bKey = System.Text.UTF8Encoding.UTF8.GetBytes("key"); byte[] bData = System.Text.UTF8Encoding.UTF8.GetBytes("The quick brown fox jumps over the lazy dog"); HMACSHA1 sha = new HMACSHA1(bKey); byte[] bRethmacsha1 = sha.ComputeHash(bData); System.Diagnostics.Debug.WriteLine("SHA1 HMAC is: "); System.Diagnostics.Debug.WriteLine(SocketServer.TLS.ByteHelper.HexStringFromByte(bRethmacsha1, true, 8)); //should be this for HMACSHA1 - DE 7C 9B 85 B8 B7 8A A6 BC 8A 7A 36 F7 0A 90 70 1C 9D B4 D9 SocketServer.TLS.HMACMD5 md5 = new SocketServer.TLS.HMACMD5(bKey); byte[] bRethmacmd5 = md5.ComputeHash(bData); System.Diagnostics.Debug.WriteLine("MD5 HMAC is: "); System.Diagnostics.Debug.WriteLine(SocketServer.TLS.ByteHelper.HexStringFromByte(bRethmacmd5, true, 8)); /// should be this for HMAC MD5 - 80 07 07 13 46 3E 77 49 B9 0C 2D C2 49 11 E2 75 }