1 |
--- |
2 |
pym/portage/checksum.py | 5 ++++- |
3 |
pym/portage/const.py | 3 ++- |
4 |
pym/portage/tests/util/test_checksum.py | 18 ++++++++++++++++++ |
5 |
3 files changed, 24 insertions(+), 2 deletions(-) |
6 |
|
7 |
diff --git a/pym/portage/checksum.py b/pym/portage/checksum.py |
8 |
index 92b41b133..3ee100c3f 100644 |
9 |
--- a/pym/portage/checksum.py |
10 |
+++ b/pym/portage/checksum.py |
11 |
@@ -137,7 +137,8 @@ if "SHA3_256" not in hashfunc_map or "SHA3_512" not in hashfunc_map: |
12 |
|
13 |
# Support pygcrypt as fallback using optimized routines from libgcrypt |
14 |
# (GnuPG). |
15 |
-gcrypt_algos = frozenset(('RMD160', 'WHIRLPOOL', 'SHA3_256', 'SHA3_512')) |
16 |
+gcrypt_algos = frozenset(('RMD160', 'WHIRLPOOL', 'SHA3_256', 'SHA3_512', |
17 |
+ 'STREEBOG256', 'STREEBOG512')) |
18 |
if gcrypt_algos.difference(hashfunc_map): |
19 |
try: |
20 |
import binascii |
21 |
@@ -158,6 +159,8 @@ if gcrypt_algos.difference(hashfunc_map): |
22 |
'WHIRLPOOL': 'whirlpool', |
23 |
'SHA3_256': 'sha3-256', |
24 |
'SHA3_512': 'sha3-512', |
25 |
+ 'STREEBOG256': 'stribog256', |
26 |
+ 'STREEBOG512': 'stribog512', |
27 |
} |
28 |
|
29 |
for local_name, gcry_name in name_mapping.items(): |
30 |
diff --git a/pym/portage/const.py b/pym/portage/const.py |
31 |
index 0cef2e8ae..7e415ba9c 100644 |
32 |
--- a/pym/portage/const.py |
33 |
+++ b/pym/portage/const.py |
34 |
@@ -232,7 +232,8 @@ MANIFEST1_REQUIRED_HASH = "MD5" |
35 |
# - Remove redundant settings from gentoo-x86/metadata/layout.conf. |
36 |
|
37 |
MANIFEST2_HASH_FUNCTIONS = ("SHA256", "SHA512", "WHIRLPOOL", |
38 |
- "BLAKE2B", "BLAKE2S", "SHA3_256", "SHA3_512") |
39 |
+ "BLAKE2B", "BLAKE2S", "SHA3_256", "SHA3_512", |
40 |
+ "STREEBOG256", "STREEBOG512") |
41 |
MANIFEST2_HASH_DEFAULTS = frozenset(["SHA256", "SHA512", "WHIRLPOOL"]) |
42 |
MANIFEST2_REQUIRED_HASH = "SHA256" |
43 |
|
44 |
diff --git a/pym/portage/tests/util/test_checksum.py b/pym/portage/tests/util/test_checksum.py |
45 |
index 72b8cef3f..01ac8f9d0 100644 |
46 |
--- a/pym/portage/tests/util/test_checksum.py |
47 |
+++ b/pym/portage/tests/util/test_checksum.py |
48 |
@@ -86,3 +86,21 @@ class ChecksumTestCase(TestCase): |
49 |
'6634c004dc31822fa65c2f1e2e3bbf0cfa35085653cca1ca9ca42f8f3f13c908405e0b665918146181c9fc9a9d793fc05429d669c35a55517820dfaa071425ca') |
50 |
except DigestException: |
51 |
self.skipTest('SHA3_512 implementation not available') |
52 |
+ |
53 |
+ def test_streebog256(self): |
54 |
+ try: |
55 |
+ self.assertEqual(checksum_str(b'', 'STREEBOG256'), |
56 |
+ '3f539a213e97c802cc229d474c6aa32a825a360b2a933a949fd925208d9ce1bb') |
57 |
+ self.assertEqual(checksum_str(self.text, 'STREEBOG256'), |
58 |
+ '4992f1239c46f15b89e7b83ded4d83fb5966da3692788a4a1a6d118f78c08444') |
59 |
+ except DigestException: |
60 |
+ self.skipTest('STREEBOG256 implementation not available') |
61 |
+ |
62 |
+ def test_streebog512(self): |
63 |
+ try: |
64 |
+ self.assertEqual(checksum_str(b'', 'STREEBOG512'), |
65 |
+ '8e945da209aa869f0455928529bcae4679e9873ab707b55315f56ceb98bef0a7362f715528356ee83cda5f2aac4c6ad2ba3a715c1bcd81cb8e9f90bf4c1c1a8a') |
66 |
+ self.assertEqual(checksum_str(self.text, 'STREEBOG512'), |
67 |
+ '330f5c26437f4e22c0163c72b12e93b8c27202f0750627355bdee43a0e0b253c90fbf0a27adbe5414019ff01ed84b7b240a1da1cbe10fae3adffc39c2d87a51f') |
68 |
+ except DigestException: |
69 |
+ self.skipTest('STREEBOG512 implementation not available') |
70 |
-- |
71 |
2.12.0 |