HMAC_SHA1 does not match test vectors

Paul Lambert <[email protected]>
Newsgroups gmane.comp.python.cryptography
Message-ID <[email protected]>
Has anyone successfully tested the python hmac with
sha1?   Looking at the built-in regression tests, it has only been tested for md5.

In using the HMAC_SHA1, I can not get the results to
match the published test vectors in RFC 2202 :-(

For example:

>>> import hmac
>>> import sha
>>> import md5
>>> hm=hmac.new("Jefe","what do ya want for nothing?",sha)
>>> hm.hexdigest()
'effcdf6ae5eb2fa2d27416d5f184df9c259a7c79'

The actual result should be:
'750c783e6ab0b503eaa86e310a5db738'

What's odd is that the hmac.py works fine for
md5 and matches all the test vectors.  SHA1 seems to
have problems.

Advice on how to get the correct test vector results
would be greatly appreciated.

Regards,

Paul
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.