1 |
Support the pure Python implementation of Streebog in pygost as |
2 |
a fallback algorithm. The code is horrible (it stores all the data |
3 |
in memory before hashing), so it is really intended as last fallback. |
4 |
--- |
5 |
pym/portage/checksum.py | 15 +++++++++++++++ |
6 |
1 file changed, 15 insertions(+) |
7 |
|
8 |
diff --git a/pym/portage/checksum.py b/pym/portage/checksum.py |
9 |
index 3ee100c3f..df896533f 100644 |
10 |
--- a/pym/portage/checksum.py |
11 |
+++ b/pym/portage/checksum.py |
12 |
@@ -247,6 +247,21 @@ if 'RMD160' not in hashfunc_map or 'WHIRLPOOL' not in hashfunc_map: |
13 |
pass |
14 |
|
15 |
|
16 |
+# Support pygost as fallback streebog provider |
17 |
+# It's mostly provided as a reference implementation; it's pure Python, |
18 |
+# slow and reads all data to memory (i.e. doesn't hash on update()...) |
19 |
+if 'STREEBOG256' not in hashfunc_map or 'STREEBOG512' not in hashfunc_map: |
20 |
+ try: |
21 |
+ import pygost.gost34112012 |
22 |
+ |
23 |
+ _generate_hash_function("STREEBOG256", |
24 |
+ functools.partial(pygost.gost34112012.GOST34112012, digest_size=32), origin="pygost") |
25 |
+ _generate_hash_function("STREEBOG512", |
26 |
+ functools.partial(pygost.gost34112012.GOST34112012, digest_size=64), origin="pygost") |
27 |
+ except ImportError: |
28 |
+ pass |
29 |
+ |
30 |
+ |
31 |
_whirlpool_unaccelerated = False |
32 |
if "WHIRLPOOL" not in hashfunc_map: |
33 |
# Bundled WHIRLPOOL implementation |
34 |
-- |
35 |
2.12.0 |