skip to navigation
skip to content

pysha3 1.0.2

SHA-3 (Keccak) for Python 2.7 - 3.5

SHA-3 wrapper (keccak) for Python. The package is a wrapper around the optimized Keccak Code Package, .

The module is a standalone version of my SHA-3 module from Python 3.6 (currently under development). The code in sha3module.c has been modified to be compatible with Python 2.7 to 3.5. Python 2.6 and earlier are not supported.

Updates since pysha 0.3

pysha3 1.0 is not compatible with pysha3 0.3!

pysha3 < 1.0 used the old Keccak implementation. During the finalization of SHA3, NIST changed the delimiter suffix from 0x01 to 0x06. The Keccak sponge function stayed the same. pysha3 1.0 provides the previous Keccak hash, too.


pysha3 has been successfully tested on several platforms:

  • Linux (GCC, clang) on X86, X86_64 and ARMv6 (little endian)
  • Windows (VS 2008, VS 2010, VS2015) on X86 and X86_64


The sha3 module contains several constructors for hash objects with a PEP 247 compatible interface. The module provides SHA3, SHAKE and Keccak:

  • sha3_228(), sha3_256(), sha3_384(), and sha3_512()
  • shake_128(), shake_256()
  • keccak_228(), keccak_256(), keccak_384(), and keccak_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.6 will support the four SHA-3 algorithms and the two SHAKE 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, 6):
...    import sha3
>>> s = hashlib.sha3_512()
>>> s.digest_size
>>> s.update(b"data")
>>> s.hexdigest()

>>> s = hashlib.shake_256()
>>> s.update(b"data")
>>> s.hexdigest(4)
>>> s.hexdigest(8)
>>> s.hexdigest(16)

>>> import sha3
>>> k = sha3.keccak_512()
>>> k.update(b"data")
>>> k.hexdigest()


pysha3 1.0.2

Release: 05-Feb-2017

  • Rename internal C extension to _pysha3 to avoild conflict with Python 3.6’ _sha3 extension.

pysha3 1.0.1

Release: 24-Jan-2017

  • Fix -> (Pi Delport)
  • Fix endianness checks for Python 2 (William Grant)
  • Fix changelog, the Christmas release was 1.0.0, not 1.1.0

pysha3 1.0.0

Release date: 24-Dec-2016

  • Synchronize with Python 3.6.0 release
  • Move all backport related additions to
  • Fix flake8 violations

pysha3 1.0b1

Release date: 01-May-2016

  • Update backend to use the latest Keccak Code Package. pysha3 now implements the official NIST standard. The old Keccak hashes are available with keccak prefix.
  • Add SHAKE support.
  • All sha3, shake and keccak variants are separate types instead of factory functions that return the same type.
  • Drop Python 2.6 and Python 3.0 to 3.3 support.
  • Fix typo that disabled threading optimization.
  • Add vector files for additional tests.
  • Add experimental HMAC support based on examples from .
  • Test hashing of unaligned data.
  • Add ISO C11 memset_s() function as _Py_memset_s() in order to securely wipe memory that holds sensitive data. The page explains the motivation for memset_s().
  • Add tox support.
  • Add Travis and appveyor integration.
  • Add _capacity_bits, _rate_bits and _suffix attributes for diagnostic purposes.

pysha3 0.3

Release date: 14-Oct-2012

  • Fix 64bit big endian support
  • Add workaround for alignment error on 64bit SPARC machine by using the opt32 implementation.
  • block_size now returns NotImplemented to prevent users from using pysha3 with the hmac module.

pysha3 0.2.2

Release date: 07-Oct-2012

  • Re-add brg_endian.h to fix issue on Solaris (big endian platform)

pysha3 0.2.1

Release date: 06-Oct-2012

  • Fix to include Makefile and
  • Add test command with hack for inplace builds
  • Enhance 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“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
File Type Py Version Uploaded on Size
pysha3-1.0.2-cp27-cp27m-win32.whl (md5) Python Wheel cp27 2017-02-05 19KB
pysha3-1.0.2-cp27-cp27m-win_amd64.whl (md5) Python Wheel cp27 2017-02-05 35KB
pysha3-1.0.2-cp33-cp33m-win32.whl (md5) Python Wheel cp33 2017-02-05 21KB
pysha3-1.0.2-cp33-cp33m-win_amd64.whl (md5) Python Wheel cp33 2017-02-05 35KB
pysha3-1.0.2-cp34-cp34m-win32.whl (md5) Python Wheel cp34 2017-02-05 21KB
pysha3-1.0.2-cp34-cp34m-win_amd64.whl (md5) Python Wheel cp34 2017-02-05 35KB
pysha3-1.0.2-cp35-cp35m-win32.whl (md5) Python Wheel cp35 2017-02-05 21KB
pysha3-1.0.2-cp35-cp35m-win_amd64.whl (md5) Python Wheel cp35 2017-02-05 35KB
pysha3-1.0.2-cp36-cp36m-win32.whl (md5) Python Wheel cp36 2017-02-05 21KB
pysha3-1.0.2-cp36-cp36m-win_amd64.whl (md5) Python Wheel cp36 2017-02-05 35KB
pysha3-1.0.2.tar.gz (md5, pgp) Source 2017-02-05 809KB