Description of problem: This hashlib package does not work with the Python2.4 hmac module. For more details on this issue, see this ticket. http://trac.turbogears.org/ticket/2133 The "solution" proposed is to monkey-patch Python2.4's hmac.HMAC to point to Python2.5's hmac.HMAC25. The attached package ships Python2.5's hmac.py, and patches hashlib.py to perform this monkey-patching. I also enabled the test suite, which still passes: + /usr/bin/python test/test_hashlib.py test_case_md5_0 (__main__.HashLibTestCase) ... ok test_case_md5_1 (__main__.HashLibTestCase) ... ok test_case_md5_2 (__main__.HashLibTestCase) ... ok test_case_sha1_0 (__main__.HashLibTestCase) ... ok test_case_sha1_1 (__main__.HashLibTestCase) ... ok test_case_sha1_2 (__main__.HashLibTestCase) ... ok test_case_sha1_3 (__main__.HashLibTestCase) ... ok test_case_sha224_0 (__main__.HashLibTestCase) ... ok test_case_sha224_1 (__main__.HashLibTestCase) ... ok test_case_sha224_2 (__main__.HashLibTestCase) ... ok test_case_sha224_3 (__main__.HashLibTestCase) ... ok test_case_sha256_0 (__main__.HashLibTestCase) ... ok test_case_sha256_1 (__main__.HashLibTestCase) ... ok test_case_sha256_2 (__main__.HashLibTestCase) ... ok test_case_sha256_3 (__main__.HashLibTestCase) ... ok test_case_sha384_0 (__main__.HashLibTestCase) ... ok test_case_sha384_1 (__main__.HashLibTestCase) ... ok test_case_sha384_2 (__main__.HashLibTestCase) ... ok test_case_sha384_3 (__main__.HashLibTestCase) ... ok test_case_sha512_0 (__main__.HashLibTestCase) ... ok test_case_sha512_1 (__main__.HashLibTestCase) ... ok test_case_sha512_2 (__main__.HashLibTestCase) ... ok test_case_sha512_3 (__main__.HashLibTestCase) ... ok test_hexdigest (__main__.HashLibTestCase) ... ok test_large_update (__main__.HashLibTestCase) ... ok test_unknown_hash (__main__.HashLibTestCase) ... ok ---------------------------------------------------------------------- Ran 26 tests in 0.152s OK http://lmacken.fedorapeople.org/rpms/python-hashlib-20081119-5.fc10.src.rpm http://lmacken.fedorapeople.org/rpms/python-hashlib.spec * Mon Jun 01 2009 Luke Macken <lmacken> - 20081119-5 - Add python-hashlib-hmac25.patch to work around some Python2.4 hmac / hashlib incompatibility - Include Python2.5's hmac.py as hmac25.py in our site-packages - Run the hashlib test suite
A more realistic fix could involve removing the hashlib usage in the offending modules (Beaker, Paste), and just default back to the old sha1/md5 modules. Testing this now with Beaker.
I was able to hack around this issue in Beaker itself, by patching out it's use of hashlib on EL-5.