pysha3

raw JSON →
1.0.2 verified Mon Apr 27 auth: no python deprecated

SHA-3 (Keccak) hash functions for Python 2.7 to 3.5. Version 1.0.2 is the latest, released in 2017. The library is unmaintained and incompatible with Python 3.6+ due to the `hashlib` standard library having built-in SHA-3 support.

pip install pysha3
error No module named 'pysha3'
cause pysha3 is not installed or Python version is 3.6+ where it is not needed.
fix
Install pysha3: pip install pysha3. For Python 3.6+, consider using hashlib.sha3_* instead.
error AttributeError: module 'hashlib' has no attribute 'sha3_256'
cause Python version is <3.6, which does not have built-in SHA-3 in hashlib.
fix
Install pysha3: pip install pysha3 and use from pysha3 import sha3_256.
deprecated pysha3 is unmaintained and only supports Python up to 3.5. For Python 3.6+, use hashlib.sha3_* from the standard library.
fix Replace `from pysha3 import sha3_256` with `import hashlib; hashlib.sha3_256()`
gotcha pysha3 output may differ from other SHA-3 implementations due to different padding rules for Keccak. Ensure compatibility with your application.
fix Always confirm the expected output against known test vectors.
breaking Python 3.6+ included SHA-3 in hashlib, making pysha3 obsolete. Importing pysha3 on Python 3.6+ will still work but is redundant.
fix Use `hashlib.sha3_256()` instead.

Create a SHA3-256 hash of b'hello' using pysha3.

from pysha3 import sha3_256
h = sha3_256(b'hello')
print(h.hexdigest())  # Output: 3338be694f50c5f338814986cdf0686453a40b544b9f7c2e8b8b3d0b6f1f3c1e