Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 148514

Summary: Portage should use hashlib if available
Product: Portage Development Reporter: Aidan Thornton <makosoft>
Component: Enhancement/Feature RequestsAssignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: enhancement CC: nelchael
Priority: High Keywords: InVCS
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 181949    
Attachments: Proposed patch to portage_checksum.py
New patch to portage_checksum.py

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.