commit: 0eba01c258f8b3716cff0a768afaa3bb0271479b
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 12 17:02:01 2017 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Mar 13 21:46:30 2017 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=0eba01c2
portage.checksum: Support pygost as fallback Streebog provider
Support the pure Python implementation of Streebog in pygost as
a fallback algorithm. The code is horrible (it stores all the data
in memory before hashing), so it is really intended as last fallback.
pym/portage/checksum.py | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/pym/portage/checksum.py b/pym/portage/checksum.py
index 3ee100c3f..df896533f 100644
--- a/pym/portage/checksum.py
+++ b/pym/portage/checksum.py
@@ -247,6 +247,21 @@ if 'RMD160' not in hashfunc_map or 'WHIRLPOOL' not in
hashfunc_map:
pass
+# Support pygost as fallback streebog provider
+# It's mostly provided as a reference implementation; it's pure Python,
+# slow and reads all data to memory (i.e. doesn't hash on update()...)
+if 'STREEBOG256' not in hashfunc_map or 'STREEBOG512' not in hashfunc_map:
+ try:
+ import pygost.gost34112012
+
+ _generate_hash_function("STREEBOG256",
+ functools.partial(pygost.gost34112012.GOST34112012,
digest_size=32), origin="pygost")
+ _generate_hash_function("STREEBOG512",
+ functools.partial(pygost.gost34112012.GOST34112012,
digest_size=64), origin="pygost")
+ except ImportError:
+ pass
+
+
_whirlpool_unaccelerated = False
if "WHIRLPOOL" not in hashfunc_map:
# Bundled WHIRLPOOL implementation