eth-hash is a low-level Python library that provides the Ethereum hashing function, Keccak256. While sometimes erroneously referred to as SHA3, it implements the specific Keccak variant used in Ethereum. It is primarily intended for internal use by other Ethereum development tools. The current version is 0.8.0, with releases driven by the needs of the broader Ethereum ecosystem.
pip install "eth-hash[pycryptodome]"Verified import paths — ran on the pinned version, not inferred.
Demonstrates how to compute a Keccak256 hash using the automatically selected backend, both for a single input and incrementally. The output is a bytes object, which can be converted to a hexadecimal string for display.
Always refer to and use functions explicitly implementing 'Keccak256' for Ethereum compatibility. `eth-hash` correctly implements Keccak256.
Install `eth-hash` with a chosen backend as an extra, e.g., `pip install "eth-hash[pycryptodome]"` or `pip install "eth-hash[pysha3]"`. `pycryptodome` is generally recommended for its performance and broader compatibility.
Consider using `from eth_utils import keccak` if you need a higher-level API or other Ethereum-related utilities, otherwise `eth-hash` is appropriate for direct Keccak256 operations.
pip install eth-hash
from eth_hash.auto import keccak
pip install "eth-hash[pycryptodome]"