public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Brian Harring <ferringb@gmail.com>
To: gentoo-portage-dev@lists.gentoo.org
Subject: Re: [gentoo-portage-dev] [GLEP59v2 2/5] Manifest2 hash: Whirlpool
Date: Sat, 1 Oct 2011 02:41:13 -0700	[thread overview]
Message-ID: <20111001094113.GA3765@localhost> (raw)
In-Reply-To: <1317454855-2794-3-git-send-email-robbat2@gentoo.org>

On Sat, Oct 01, 2011 at 07:40:52AM +0000, Robin H. Johnson wrote:
> From: "Robin H. Johnson" <robbat2@gentoo.org>
> 
> Provide public-domain implementation of the Whirlpool hash algorithm to
> be used as new Manifest2 hash.
> 
> Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
> ---
>  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
> 



  reply	other threads:[~2011-10-01  9:41 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-01  7:40 [gentoo-portage-dev] [GLEP59v2 0/5] GLEP59: Manifest2 hash types Robin H. Johnson
2011-10-01  7:40 ` [gentoo-portage-dev] [GLEP59v2 1/5] Refactor RMD160 hashlib code for less-hardcoding Robin H. Johnson
2011-10-01  7:40 ` [gentoo-portage-dev] [GLEP59v2 2/5] Manifest2 hash: Whirlpool Robin H. Johnson
2011-10-01  9:41   ` Brian Harring [this message]
2011-10-02  6:15     ` Zac Medico
2011-10-01  7:40 ` [gentoo-portage-dev] [GLEP59v2 3/5] Manifest2 hash: SHA512 Robin H. Johnson
2011-10-01  7:40 ` [gentoo-portage-dev] [GLEP59v2 4/5] Manifest2 hash backend provider: mhash Robin H. Johnson
2011-10-01  7:40 ` [gentoo-portage-dev] [GLEP59v2 5/5] GLEP59: Change live Manifest2 hashes to SHA256, SHA512, WHIRLPOOL Robin H. Johnson
2011-10-02  4:40   ` Zac Medico
2011-10-02  6:14     ` Zac Medico
2011-10-02 12:46     ` Robin H. Johnson
2011-10-02 20:39       ` Zac Medico
2011-10-02 20:46         ` Alec Warner
2011-10-02 20:54         ` Robin H. Johnson
2011-10-02 21:10           ` Zac Medico
2011-10-02 23:22             ` Brian Harring
2011-10-03  0:21               ` Zac Medico
2011-10-03  9:48                 ` Zac Medico
2011-10-03 11:43                   ` Brian Harring
2011-10-03 14:18                     ` Zac Medico
2011-10-05 18:07 ` [gentoo-portage-dev] [GLEP59v2 0/5] GLEP59: Manifest2 hash types Zac Medico
2011-10-05 18:24   ` Robin H. Johnson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111001094113.GA3765@localhost \
    --to=ferringb@gmail.com \
    --cc=gentoo-portage-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox