1 |
--- |
2 |
pym/portage/checksum.py | 22 ++++++++++++++++++++++ |
3 |
1 file changed, 22 insertions(+) |
4 |
|
5 |
diff --git a/pym/portage/checksum.py b/pym/portage/checksum.py |
6 |
index fc38417a7..042a0a745 100644 |
7 |
--- a/pym/portage/checksum.py |
8 |
+++ b/pym/portage/checksum.py |
9 |
@@ -116,6 +116,28 @@ try: |
10 |
except ImportError: |
11 |
pass |
12 |
|
13 |
+try: |
14 |
+ # added in pycryptodome |
15 |
+ from Crypto.Hash import BLAKE2b, BLAKE2s, SHA3_256, SHA3_512 |
16 |
+ blake2bhash_ = getattr(BLAKE2b, 'new', None) |
17 |
+ if blake2bhash_ is not None: |
18 |
+ blake2bhash = _generate_hash_function("BLAKE2B", |
19 |
+ blake2bhash_, origin="pycrypto") |
20 |
+ blake2shash_ = getattr(BLAKE2s, 'new', None) |
21 |
+ if blake2shash_ is not None: |
22 |
+ blake2shash = _generate_hash_function("BLAKE2S", |
23 |
+ blake2shash_, origin="pycrypto") |
24 |
+ sha3_256hash_ = getattr(SHA3_256, 'new', None) |
25 |
+ if sha3_256hash_ is not None: |
26 |
+ sha3_256hash = _generate_hash_function("SHA3_256", |
27 |
+ sha3_256hash_, origin="pycrypto") |
28 |
+ sha3_512hash_ = getattr(SHA3_512, 'new', None) |
29 |
+ if sha3_512hash_ is not None: |
30 |
+ sha3_512hash = _generate_hash_function("SHA3_512", |
31 |
+ sha3_512hash_, origin="pycrypto") |
32 |
+except ImportError: |
33 |
+ pass |
34 |
+ |
35 |
# Use hashlib from python-2.5 if available and prefer it over pycrypto and internal fallbacks. |
36 |
# Need special handling for RMD160/WHIRLPOOL as they may not always be provided by hashlib. |
37 |
try: |
38 |
-- |
39 |
2.12.0 |