commit:     0751158e5de176befeed5cb694342a1f0e19e895
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 12 15:21:44 2017 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Mar 13 21:46:29 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=0751158e

portage.checksum: Fix BLAKE2* fallbacks from pycryptodome

Fix BLAKE2* fallback functions to explicitly provide digest length as
required by pycryptodome.

 pym/portage/checksum.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/pym/portage/checksum.py b/pym/portage/checksum.py
index 9ba251f29..82e8bec00 100644
--- a/pym/portage/checksum.py
+++ b/pym/portage/checksum.py
@@ -132,14 +132,16 @@ except ImportError:
 try:
        # added in pycryptodome
        from Crypto.Hash import BLAKE2b, BLAKE2s, SHA3_256, SHA3_512
+       import functools
+
        blake2bhash_ = getattr(BLAKE2b, 'new', None)
        if blake2bhash_ is not None:
                blake2bhash = _generate_hash_function("BLAKE2B",
-                       blake2bhash_, origin="pycrypto")
+                       functools.partial(blake2bhash_, digest_bytes=64), 
origin="pycrypto")
        blake2shash_ = getattr(BLAKE2s, 'new', None)
        if blake2shash_ is not None:
                blake2shash = _generate_hash_function("BLAKE2S",
-                       blake2shash_, origin="pycrypto")
+                       functools.partial(blake2shash_, digest_bytes=32), 
origin="pycrypto")
        sha3_256hash_ = getattr(SHA3_256, 'new', None)
        if sha3_256hash_ is not None:
                sha3_256hash = _generate_hash_function("SHA3_256",

Reply via email to