Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 148514 - Portage should use hashlib if available
Summary: Portage should use hashlib if available
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Enhancement/Feature Requests (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: 181949
  Show dependency tree
 
Reported: 2006-09-21 07:40 UTC by Aidan Thornton
Modified: 2007-06-29 02:52 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Proposed patch to portage_checksum.py (portage-hashlib.patch,2.07 KB, patch)
2006-09-21 07:42 UTC, Aidan Thornton
Details | Diff
New patch to portage_checksum.py (portage-hashlib.patch,2.13 KB, patch)
2006-09-23 06:00 UTC, Aidan Thornton
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Aidan Thornton 2006-09-21 07:40:12 UTC
Python 2.5 includes a new module - hashlib - that supports hashes (SHA256 and possibly RIPEMD160) for which Portage would otherwise need the external pycrypto package. If pycrypto is unavailable, and hashlib exists and provides the required hashes, Portage should use it. (In particular, this would simplify upgrading to Python 2.5).
Comment 1 Aidan Thornton 2006-09-21 07:42:50 UTC
Created attachment 97653 [details, diff]
Proposed patch to portage_checksum.py

A patch to portage_checksum.py to use hashlib if it's available and pycrypto isn't.
Comment 2 Marien Zwart (RETIRED) gentoo-dev 2006-09-21 07:52:26 UTC
It might be worth it to prefer hashlib over pycrypto. Some limited benchmarking indicates hashlib (using openssl) is faster than pycrypto is, and it is probably at least as reliable too (I only skimmed the patch, so if it already does that then please ignore me).
Comment 3 Aidan Thornton 2006-09-23 06:00:50 UTC
Created attachment 97838 [details, diff]
New patch to portage_checksum.py

Previous patch had a bug which caused it to fail if using pycrypto.

(The patch still only uses hashlib as a fallback if pycrypto is unavailable - it should be fairly easy to modify it to use hashlib over pycrypto though, should it be worth doing so.)
Comment 4 Zac Medico gentoo-dev 2007-06-29 02:52:43 UTC
This has been released in 2.1.3_rc6.