From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1R9w4b-0005SA-Ke for garchives@archives.gentoo.org; Sat, 01 Oct 2011 09:41:33 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E1BDE21C0CD; Sat, 1 Oct 2011 09:41:23 +0000 (UTC) Received: from mail-iy0-f181.google.com (mail-iy0-f181.google.com [209.85.210.181]) by pigeon.gentoo.org (Postfix) with ESMTP id E20F621C099 for ; Sat, 1 Oct 2011 09:41:14 +0000 (UTC) Received: by iaeo4 with SMTP id o4so3876094iae.40 for ; Sat, 01 Oct 2011 02:41:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=date:from:to:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=xly5hKT9rtiv3id5poQsdeRJBgoAPRhSneAMTceDM9o=; b=LTp9p4cKsmJcZwVNZZPDgM8QazVUcEU39h2ior6LjrSYLdo4yDzbfIlnjFpRZlvaVd YSX9YzQbtOobrdzEj6GMQboDuqlOxvB8xMSP+J07kh6XcXFgt+p5ebV5CiHQV0LTKRkm ++s69ceKsoQGAfGetmXZxkRrWF7XTRx66XxEI= Received: by 10.68.31.132 with SMTP id a4mr64762594pbi.26.1317462074328; Sat, 01 Oct 2011 02:41:14 -0700 (PDT) Received: from smtp.gmail.com:587 (74-95-192-101-SFBA.hfc.comcastbusiness.net. [74.95.192.101]) by mx.google.com with ESMTPS id y5sm28083746pbe.6.2011.10.01.02.41.12 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 01 Oct 2011 02:41:13 -0700 (PDT) Received: by smtp.gmail.com:587 (sSMTP sendmail emulation); Sat, 01 Oct 2011 02:41:13 -0700 Date: Sat, 1 Oct 2011 02:41:13 -0700 From: Brian Harring To: gentoo-portage-dev@lists.gentoo.org Subject: Re: [gentoo-portage-dev] [GLEP59v2 2/5] Manifest2 hash: Whirlpool Message-ID: <20111001094113.GA3765@localhost> References: <1317454855-2794-1-git-send-email-robbat2@gentoo.org> <1317454855-2794-3-git-send-email-robbat2@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-portage-dev@lists.gentoo.org Reply-to: gentoo-portage-dev@lists.gentoo.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1317454855-2794-3-git-send-email-robbat2@gentoo.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Archives-Salt: X-Archives-Hash: cf006473dc72ec49daa1a613e77b929a On Sat, Oct 01, 2011 at 07:40:52AM +0000, Robin H. Johnson wrote: > From: "Robin H. Johnson" > > Provide public-domain implementation of the Whirlpool hash algorithm to > be used as new Manifest2 hash. > > Signed-off-by: Robin H. Johnson > --- > pym/portage/checksum.py | 8 ++++++-- > 1 files changed, 6 insertions(+), 2 deletions(-) > > diff --git a/pym/portage/checksum.py b/pym/portage/checksum.py > index e5455fa..3593686 100644 > --- a/pym/portage/checksum.py > +++ b/pym/portage/checksum.py > @@ -71,6 +71,10 @@ except ImportError: > > sha1hash = _generate_hash_function("SHA1", _new_sha1, origin="internal") > > +# Bundled WHIRLPOOL implementation > +from portage.util.whirlpool import new as _new_whirlpool > +whirlpoolhash = _generate_hash_function("WHIRLPOOL", _new_whirlpool, origin="bundled") > + Likely should shift this to a trailing check if no whirlpool implementation was found; via this, we can avoid the import unless it's needed. ~brian > # Use pycrypto when available, prefer it over the internal fallbacks > try: > from Crypto.Hash import SHA256, RIPEMD > @@ -80,14 +84,14 @@ except ImportError as e: > pass > > # Use hashlib from python-2.5 if available and prefer it over pycrypto and internal fallbacks. > -# Need special handling for RMD160 as it may not always be provided by hashlib. > +# Need special handling for RMD160/WHIRLPOOL as they may not always be provided by hashlib. > try: > import hashlib, functools > > md5hash = _generate_hash_function("MD5", hashlib.md5, origin="hashlib") > sha1hash = _generate_hash_function("SHA1", hashlib.sha1, origin="hashlib") > sha256hash = _generate_hash_function("SHA256", hashlib.sha256, origin="hashlib") > - for local_name, hash_name in (("rmd160", "ripemd160"), ): > + for local_name, hash_name in (("rmd160", "ripemd160"), ("whirlpool", "whirlpool")): > try: > hashlib.new(hash_name) > except ValueError: > -- > 1.7.7 >