SHA-3 (Keccak) for Python 2.6 - 3.4
Project description
pysha3
SHA-3 wrapper (keccak) for Python. The package is a wrapper around the optimized reference implementation from http://keccak.noekeon.org/ . Only the optimizations for 32 and 64bit platforms are used. The optimized SSE and ARM assembly variants are ignored for now.
The module is a standalone version of the SHA-3 implemention of Python 3.4 (currently under development).
Usage
The sha3 module contains several constructors for hash objects with a PEP 247 compatible interface. The module provides sha3_228(), sha3_256(), sha3_384(), and sha3_512().
The sha3 module monkey patches the hashlib module . The monkey patch is automatically activated with the first import of the sha3 module. The hashlib module of Python 3.4 will support the four SHA-3 algorithms on all platforms. Therefore you shouldn’t use the sha3 module directly and rather go through the hashlib interface:
>>> import sys >>> import hashlib >>> if sys.version_info < (3, 4): ... import sha3 >>> s = hashlib.new("sha3_512") >>> s = hashlib.sha3_512() # alternative >>> s.name 'sha3_512' >>> s.digest_size 64 >>> s.update(b"data") >>> s.hexdigest() '1065aceeded3a5e4412e2187e919bffeadf815f5bd73d37fe00d384fe29f55f08462fdabe1007b993ce5b8119630e7db93101d9425d6e352e22ffe3dcb56b825'
Changelog
pysha3 0.2.1
Release date: 06-Oct-2012
fixed MANIFEST.in to include Makefile and tests.py
added setup.py test command with hack for inplace builds
enhanced README.txt and fixed its markup
pysha3 0.2
Release date: 06-Oct-2012
Change directory struct to use the same directory layout as Python 3.4.
Remove C++ comments from Keccak sources for ANSI C compatibility.
Declare all Keccak functions and globals as static to avoid name clashes.
Remove alias sha3() for sha3_512().
Add block_size attribute. Keccak has a internal sponge size of 1600 bits.
Release GIL around SHA3_update() calls.
Monkey patch the hashlib module to support, e.g. hashlib.sha3_512() and hashlib.new(“sha3_512”)
Release GIL around SHA3_update() when the data exceeds a certain size.
Fix build on platforms with an unsigned 64bit integer type (uint64_t). The module falls back to 32bit implementation of Keccak with interleave tables.
pysha3 0.1
Release date: 04-Oct-2012
first release
based on KeccakReferenceAndOptimized-3.2.zip
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
File details
Details for the file pysha3-0.2.1.zip
.
File metadata
- Download URL: pysha3-0.2.1.zip
- Upload date:
- Size: 58.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 703c4ad9ce4f4907992ba2a07e1431116c81b2e8d707cfd7ff40eb96bc2c14ab |
|
MD5 | 848e934b1f22c69f439350abe2f88af8 |
|
BLAKE2b-256 | 23df9082a10723eee0d6abce625e85c7979d7485a7b24506ebbd6877730a8d10 |
Provenance
File details
Details for the file pysha3-0.2.1.tar.gz
.
File metadata
- Download URL: pysha3-0.2.1.tar.gz
- Upload date:
- Size: 45.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5449d28b3a50aa683628f4b661d64c8933686a7e39f1af004b06964954f2d19 |
|
MD5 | 954d82c6a6e92f3f25e33a67b8b44aa6 |
|
BLAKE2b-256 | 8db032c25c8f1dc61734dcbf88bbed597f1483ae1a969aaf38ae41176b99214a |
Provenance
File details
Details for the file pysha3-0.2.1.win-amd64-py3.3.exe
.
File metadata
- Download URL: pysha3-0.2.1.win-amd64-py3.3.exe
- Upload date:
- Size: 276.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 21299d902cc4295b7ab813861a3882222b2fdc2e2b74d41441098c54982e3c91 |
|
MD5 | 61e7ba52fb0f992514fe4fe8721318a3 |
|
BLAKE2b-256 | 31009729fc56970abee7602812bd3416c65d4a755af039fb1d4f9472b58e9977 |
Provenance
File details
Details for the file pysha3-0.2.1.win-amd64-py3.2.exe
.
File metadata
- Download URL: pysha3-0.2.1.win-amd64-py3.2.exe
- Upload date:
- Size: 278.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b92dc6c6dfab36c01ccded121d7afd5764c5ad32f0c5494e79e867ab1143994 |
|
MD5 | 54934ed22b2ede9a22b3f503b180f68e |
|
BLAKE2b-256 | 71953ea71eb96cb96beac02868bb5511ee1040f8380c9cd44d61cb12e6135f3d |
Provenance
File details
Details for the file pysha3-0.2.1.win-amd64-py2.7.exe
.
File metadata
- Download URL: pysha3-0.2.1.win-amd64-py2.7.exe
- Upload date:
- Size: 278.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d362fc2e60f78d4dc5567cccccbd51ca5c3208dcc29bc28358a0017e44c2b14 |
|
MD5 | e306d2f45c96fa0196cd8bcad2644c3c |
|
BLAKE2b-256 | 95f89c8edb6fc6990cc5b4d75e0d32220d154705b6164cfba536d86d0d8c9540 |
Provenance
File details
Details for the file pysha3-0.2.1.win-amd64-py2.6.exe
.
File metadata
- Download URL: pysha3-0.2.1.win-amd64-py2.6.exe
- Upload date:
- Size: 246.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 512299bb4d649d5ab475cda65234e302c3381071165314f39888837e1c856773 |
|
MD5 | 4ca533cc8773cad1f7ab1c0571c85107 |
|
BLAKE2b-256 | d0a530ea99adf631e16c092585ddaa636b27431eeae66b0676db8eceb291e78f |
Provenance
File details
Details for the file pysha3-0.2.1.win32-py3.3.exe
.
File metadata
- Download URL: pysha3-0.2.1.win32-py3.3.exe
- Upload date:
- Size: 212.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a70ac210020b2427854c1a18e6d319ab8a9a02659f2e758a929aee432d62a84b |
|
MD5 | 42ac8762a6095be9220fb1f3e6d440d7 |
|
BLAKE2b-256 | ab014a7305d82bf8eeef0daff30e724d988579a70b70d145aa8d5afbb8e6a190 |
Provenance
File details
Details for the file pysha3-0.2.1.win32-py3.2.exe
.
File metadata
- Download URL: pysha3-0.2.1.win32-py3.2.exe
- Upload date:
- Size: 217.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a0e08fc8426475d09f578f21c8b04e936bd767c6aff211f7bf6e2beeae99a813 |
|
MD5 | 753d8cc5c0f82dbdbf46c8da3f560597 |
|
BLAKE2b-256 | cd9308726edecfc0e53f65de7327fcf29d527eb624ba67908cb03c5ed8f0ff63 |
Provenance
File details
Details for the file pysha3-0.2.1.win32-py2.7.exe
.
File metadata
- Download URL: pysha3-0.2.1.win32-py2.7.exe
- Upload date:
- Size: 217.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f7c194ef6fbf57de13b22d01b3e34aae3cb3cbc115c45248e9a3e09aba5f839 |
|
MD5 | a57e983b0a41f506d351d3a0ef8ebbdd |
|
BLAKE2b-256 | 4bf2588de4c28fa1bb51a8174bb42802ed3614665dff6857b7046338ca4f8fd4 |
Provenance
File details
Details for the file pysha3-0.2.1.win32-py2.6.exe
.
File metadata
- Download URL: pysha3-0.2.1.win32-py2.6.exe
- Upload date:
- Size: 216.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62a2c844d95fe3c1fec23364eece46462e4679edb054c8ca00b912bd59353418 |
|
MD5 | 6add072d98871a6a7d07154ae02f413c |
|
BLAKE2b-256 | 477832e139f0ab632ce9775cecf527dbbd3b7f3d99ee4912c2f6d51d4510b3a3 |
Comments from sha3module header
The code is based on KeccakReferenceAndOptimized-3.2.zip from 29 May 2012.
C++ comments are converted to ANSI C comments.
All functions and globals are declared static.
The typedef for UINT64 is commented out.
brg_endian.h is removed.
KeccakF-1600-opt[32|64]-settings.h are commented out
Some unused functions are commented out to silence compiler warnings.
In order to avoid name clashes with other software I have to declare all Keccak functions and global data as static. The C code is directly included into this file in order to access the static functions.
Keccak can be tuned with several paramenters. I try to explain all options as far as I understand them. The reference implementation also contains assembler code for ARM platforms (NEON instructions).
Common
64bit platforms
default settings of common options
Additional optimiation instructions (disabled by default):
When neither UseSSE, UseMMX nor UseXOP is configured, ROL64 (rotate left 64) is implemented as:
UseBebigokimisa can’t be used in combination with UseSSE, UseMMX or UseXOP. UseOnlySIMD64 has no effect unless UseSSE is specified.
Tests have shown that UseSSE + UseOnlySIMD64 is about three to four times SLOWER than UseBebigokimisa. UseSSE and UseMMX are about two times slower. (tested by CH and AP)
32bit platforms
default settings of common options