commit: 85b71d3379575cb8a5f2f79f3fc534d82c3bbf09
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 20 03:34:08 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Mar 21 02:30:24 2023 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=85b71d33
checksum: drop pycrypto/pycryptodome fallback for BLAKE2/SHA3
Included with >= Python 3.6 and we weren't testing these codepaths anyway.
Signed-off-by: Sam James <sam <AT> gentoo.org>
lib/portage/checksum.py | 55 ++++---------------------------------------------
1 file changed, 4 insertions(+), 51 deletions(-)
diff --git a/lib/portage/checksum.py b/lib/portage/checksum.py
index 11b83a1fc..96f3939c9 100644
--- a/lib/portage/checksum.py
+++ b/lib/portage/checksum.py
@@ -27,10 +27,10 @@ from portage.localization import _
# SHA512: hashlib
# RMD160: hashlib, pycrypto, mhash
# WHIRLPOOL: hashlib, mhash, bundled (C), bundled (Python)
-# BLAKE2B (512): hashlib, pycrypto
-# BLAKE2S (512): hashlib,pycrypto
-# SHA3_256: hashlib, pycrypto
-# SHA3_512: hashlib, pycrypto
+# BLAKE2B (512): hashlib
+# BLAKE2S (512): hashlib
+# SHA3_256: hashlib
+# SHA3_512: hashlib
# Dict of all available hash functions
@@ -138,53 +138,6 @@ if "RMD160" not in hashfunc_map:
except ImportError:
pass
-# The following hashes were added in pycryptodome (pycrypto fork)
-if "BLAKE2B" not in hashfunc_map:
- try:
- from Crypto.Hash import BLAKE2b
-
- blake2bhash_ = getattr(BLAKE2b, "new", None)
- if blake2bhash_ is not None:
- _generate_hash_function(
- "BLAKE2B",
- functools.partial(blake2bhash_, digest_bytes=64),
- origin="pycrypto",
- )
- except ImportError:
- pass
-
-if "BLAKE2S" not in hashfunc_map:
- try:
- from Crypto.Hash import BLAKE2s
-
- blake2shash_ = getattr(BLAKE2s, "new", None)
- if blake2shash_ is not None:
- _generate_hash_function(
- "BLAKE2S",
- functools.partial(blake2shash_, digest_bytes=32),
- origin="pycrypto",
- )
- except ImportError:
- pass
-
-if "SHA3_256" not in hashfunc_map:
- try:
- from Crypto.Hash import SHA3_256
-
- sha3_256hash_ = getattr(SHA3_256, "new", None)
- if sha3_256hash_ is not None:
- _generate_hash_function("SHA3_256", sha3_256hash_,
origin="pycrypto")
- except ImportError:
- pass
-
-if "SHA3_512" not in hashfunc_map:
- try:
- from Crypto.Hash import SHA3_512
-
- sha3_512hash_ = getattr(SHA3_512, "new", None)
- if sha3_512hash_ is not None:
- _generate_hash_function("SHA3_512", sha3_512hash_,
origin="pycrypto")
- except ImportError:
pass