Bug 503772 - python-hashlib does not work with the Python2.4's hmac module
Summary: python-hashlib does not work with the Python2.4's hmac module
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora EPEL
Classification: Fedora
Component: python-hashlib
Version: el5
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Dennis Gilmore
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 468230
TreeView+ depends on / blocked
 
Reported: 2009-06-02 16:05 UTC by Luke Macken
Modified: 2016-09-20 02:39 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2009-06-02 17:39:03 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Luke Macken 2009-06-02 16:05:44 UTC
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

Comment 1 Luke Macken 2009-06-02 17:17:09 UTC
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.

Comment 2 Luke Macken 2009-06-02 17:39:03 UTC
I was able to hack around this issue in Beaker itself, by patching out it's use of hashlib on EL-5.


Note You need to log in before you can comment on or make changes to this bug.