[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

HMAC-MD5 test vectors?




Has anyone else tried implementing HMAC-MD5 and used the test vectors
specified in RFC 2104 to verify their implementation?

I'm tearing my hair out, because I'm consistently getting

		6372bd727c8a3c98f2850e7766e4148a

as the MAC for first test vector, but RFC 2104 says that the correct MAC
should be:

		9294727a3638bb1c13f48ef8158bfc9d

I've even tried using the sample implementation found in RFC-2104, and
I'm getting the same results.  (Note that it's missing a semi-colon or
two.  :-)

I'm using a version of MD5 from PGP (written by Colin Plumb) which has
passed the MD5 validation suite, so it doesn't look like an MD5
problem. 

I'm left with the conclusion that the test vectors might be wrong,
although it's hard to believe no one had double checked them before
publishing the RFC.  It's possible I made a mistake in my test driver
code, but I have single-stepped it through a debugger and looks fine.

Also, the second and third vectors work just fine, either using my
implementation or the sample implementation from RFC-2104; it's only the
first test vector where I'm losing.

If someone else has an implementation which passes all three test
vectors, could they please let me know?

Many thanks...

						- Ted


Test #1 digest is 6372bd727c8a3c98f2850e7766e4148a
Test #1 failed!  Should have been:  9294727a3638bb1c13f48ef8158bfc9d

Test #2 digest is 750c783e6ab0b503eaa86e310a5db738
Test #3 digest is 56be34521d144c88dbb8c733f0e8b3f6


HMAC-MD5 time trial.  MAC'ing 100000 1024-byte blocks ...

Time = 11 seconds
Speed = 9309090 bytes/second


Follow-Ups: