From 121b9487d13b7dcd5a864a6067c4a5c88ba15b5d Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Tue, 6 Sep 2016 22:03:25 +0200 Subject: Issue #26798: Add BLAKE2 (blake2b and blake2s) to hashlib. --- setup.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'setup.py') diff --git a/setup.py b/setup.py index 8c13cf29a0..bbb6bb79ec 100644 --- a/setup.py +++ b/setup.py @@ -889,6 +889,22 @@ class PyBuildExt(build_ext): exts.append( Extension('_sha1', ['sha1module.c'], depends=['hashlib.h']) ) + blake2_deps = [os.path.join('_blake2', 'impl', name) + for name in os.listdir('Modules/_blake2/impl')] + blake2_deps.append('hashlib.h') + + blake2_macros = [] + if os.uname().machine == "x86_64": + # Every x86_64 machine has at least SSE2. + blake2_macros.append(('BLAKE2_USE_SSE', '1')) + + exts.append( Extension('_blake2', + ['_blake2/blake2module.c', + '_blake2/blake2b_impl.c', + '_blake2/blake2s_impl.c'], + define_macros=blake2_macros, + depends=blake2_deps) ) + # Modules that provide persistent dictionary-like semantics. You will # probably want to arrange for at least one of them to be available on # your machine, though none are defined by default because of library -- cgit v1.2.1