ETH_HASH(1)

πŸ“¦ version 0.8.0, in arch rolling

πŸ’œ ETH_HASH(1) πŸ’œ

okay bestie, you found it β€” this is the manual page for eth-hash, and no, it is not a command you type in your terminal, it's a whole Python library for hashing things the Ethereum way. settle in, grab a strawberry πŸ“, and let's go.

✨ NAME ✨

eth_hash β€” eth-hash Documentation

It's the Ethereum hashing function, keccak256, which people sometimes (erroneously!) call sha3. yes, that's the whole vibe. say it with me: keccak256. not sha3. πŸ’…


πŸŽ€ INSTALLATION πŸŽ€

Start here, bestie:

python -m pip install eth-hash

🌸 Quickstart 🌸

πŸ¦‹ Choose a hashing backend πŸ¦‹

If you're not sure which one to pick, choose "pycryptodome" because it supports pypy3. that's the whole reasoning, it's giving practical queen πŸ‘‘

You can find a full list of each currently supported backend in eth_hash.backends.

πŸ¦‹ Install πŸ¦‹

Put the backend you would like to use in brackets during install, like this:

python -m pip install "eth-hash[pycryptodome]"

brackets. that's it. that's the trick πŸŽ€

πŸ¦‹ Compute a Keccak256 Hash πŸ¦‹

the moment you've all been waiting for:

>>> from eth_hash.auto import keccak
>>> keccak(b'')
b"\xc5\xd2F\x01\x86\xf7#<\x92~}\xb2\xdc\xc7\x03\xc0\xe5\x00\xb6S\xca\x82';{\xfa\xd8\x04]\x85\xa4p"

You may also compute hashes incrementally, which is lowkey iconic:

>>> from eth_hash.auto import keccak
>>> preimage = keccak.new(b'part-a')
>>> preimage.update(b'part-b')
>>> preimage.digest()
b'6\x91l\xdd50\xd6[\x7f\xf9B\xff\xc9SW\x98\xc3\xaal\xd9\xde\xdd6I\xb7\x91\x9e\xf4`pl\x08'

The preimage object returned may be copied as well. look at her go 🫢

>>> from eth_hash.auto import keccak
>>> preimage = keccak.new(b'part-a')
>>> preimage_copy = preimage.copy()
>>> preimage.update(b'part-b')
>>> preimage.digest()
b'6\x91l\xdd50\xd6[\x7f\xf9B\xff\xc9SW\x98\xc3\xaal\xd9\xde\xdd6I\xb7\x91\x9e\xf4`pl\x08'
>>> preimage_copy.update(b'part-c')
>>> preimage_copy.digest()
b'\xffcy45\xea\xdd\xdf\x8e(\x1c\xfcF\xf3\xd4\xa1S\x0f\xdf\xd8\x01!\xb2(\xe1\xc7\xc6\xa3\x08\xc3\n\x0b'

πŸ¦‹ Select one of many installed backends πŸ¦‹

If you have several backends installed, you may want to explicitly specify which one to load. You can specify it in an environment variable, or at runtime. two paths, both slay ✨

πŸ¦‹ Specify backend by environment variable πŸ¦‹

$ ETH_HASH_BACKEND="pysha3" python
>>> from eth_hash.auto import keccak
# This runs with the pysha3 backend
>>> keccak(b'')
b"\xc5\xd2F\x01\x86\xf7#<\x92~}\xb2\xdc\xc7\x03\xc0\xe5\x00\xb6S\xca\x82';{\xfa\xd8\x04]\x85\xa4p"

πŸ¦‹ Specify backend at runtime πŸ¦‹

>>> from eth_hash.backends import pysha3
>>> from eth_hash import Keccak256
>>> keccak = Keccak256(pysha3)
>>> keccak(b'')
b"\xc5\xd2F\x01\x86\xf7#<\x92~}\xb2\xdc\xc7\x03\xc0\xe5\x00\xb6S\xca\x82';{\xfa\xd8\x04]\x85\xa4p"

🌈 eth_hash.backends package 🌈

(this is a module index entry β€” heading only, no extra prose in the source, don't come for me πŸ™ˆ)

🌈 Submodules 🌈

🌈 eth_hash.backends.auto module 🌈

🌈 eth_hash.backends.pycryptodome module 🌈

🌈 eth_hash.backends.pysha3 module 🌈

🌈 Module contents 🌈

🌈 eth_hash package 🌈

🌈 eth_hash.auto module 🌈

🌈 eth_hash.main module 🌈


πŸ“œ Release Notes πŸ“œ

quick housekeeping bestie: every #NN you see below is a GitHub issue, and it lives at https://github.com/ethereum/eth-hash/issues/NN. so #66 β†’ https://github.com/ethereum/eth-hash/issues/66, and so on. all the links are in there, no cap 🫢

⭐ eth-hash v0.8.0 (2026-03-25)

No significant changes. literally nothing to report, she's just chilling πŸ’…

⭐ eth-hash v0.8.0-beta.1 (2025-12-17)

Breaking Changes

  • Drop support for Python 3.8 and 3.9 (#66)

Features

  • Add support for Python 3.14 (#66)

⭐ eth-hash v0.7.1 (2025-01-13)

Internal Changes - for eth-hash Contributors

  • Merge template, updating CI runs and what is included in package files (#59)
  • Run mypy linting locally via a pre-commit hook (#60)
  • Merge template updates, notably adding support for py313 and moving docs from the README to ReadTheDocs (#61)

⭐ eth-hash v0.7.0 (2024-03-01)

Internal Changes - for eth-hash Contributors

  • Merge template updates, notably adding py312 support and testing docs build for all formats (#57)

⭐ eth-hash v0.6.0 (2024-01-10)

Breaking Changes

  • Drop python 3.7 support (#53)

Internal Changes - for eth-hash Contributors

  • Merge project template updates, notably use pre-commit for linting and change the name of master branch to main (#53)
  • Correct booleans in pyproject.toml and add test for presence of eth_hash.__version__ attribute (#55)

⭐ eth-hash v0.5.2 (2023-06-07)

Internal Changes - for eth-hash Contributors

  • remove unused docs deps, bump version of remaining (#48)
  • merge updates from the python project template (#51)

⭐ eth-hash v0.5.1 (2022-11-09)

Features

  • Add support for Python 3.11 (#45)

⭐ eth-hash v0.5.0 (2022-07-20)

Performance improvements

  • Prefer pysha3 backend by default (#42)

⭐ eth-hash v0.4.0 (2022-07-06)

Features

  • Add support for Python 3.8, 3.9, 3.10 (#40)

Deprecations and Removals

  • Drop support for Python 3.5 and 3.6 (#39)

Miscellaneous changes

  • #40, #41

⭐ eth-hash v0.3.3 (2022-06-30)

Performance improvements

  • Keccak backend was initialized every time it was called. Now it's initialized only the first time it's called. (#36)

Internal Changes - for eth-hash Contributors

  • Prune venv files from the release via MANIFEST.in (#38)

⭐ eth-hash v0.3.2 (2021-09-03)

Miscellaneous changes

  • Drop eth-utils requirement, to fix dependency cycle (#33)

⭐ eth-hash v0.3.1 (2021-01-21)

Bugfixes

  • Bugfix to export type annotations (#28)

⭐ eth-hash v0.3.0 (2021-01-20)

Features

  • Export type annotations, for use in importing projects (#29)

Internal Changes - for eth-hash Contributors

  • Import 3 years worth of template updates (#29)

⭐ v0.2.0

Released September 5, 2018

  • set pycryptodome version to >=3.6.6,<4 to fix a recently discovered vulnerability 🚨 (this one matters, don't skip it)

⭐ v0.1.4

Released May 28, 2018

  • Ensure the auto backend is pickleable (#19)

⭐ v0.1.3

Released May 14, 2018

  • The pycryptodome backend now allows update(), then digest(), then update().

⭐ v0.1.2

Released Apr 2, 2018

  • You can now import eth-hash without a backend, it won't fail until trying to generate a hash

⭐ v0.1.1

Released Mar 15, 2018

  • upgrade pycryptodome to v3.5.1+
  • performance improvements with preimage
  • Better docs and tests

⭐ v0.1.0

Released Feb 28, 2018

⭐ v0.1.0-alpha.3

Released Feb 7, 2018

  • Add pycryptodome backend support
  • Add pysha3 backend support
  • Can specify backend in environment variable ETH_HASH_BACKEND
  • New Quickstart docs (#quickstart)

⭐ v0.1.0-alpha.2

Released Feb 6, 2018

  • Bugfix pypy3 reference in pypi

⭐ v0.1.0-alpha.1

  • Launched repository, claimed names for pip, RTD, github, etc πŸ‘‘

🫢 Contributing 🫢

Thank you for your interest in contributing! We welcome all contributions no matter their size β€” like genuinely, tiny PRs are cute too. Please read along to learn how to get started. If you get stuck, feel free to ask for help in the Ethereum Python Discord server: https://discord.gg/GHryRvPB84 πŸ’œ

🧚 Setting the stage 🧚

To get started, fork the repository to your own github account, then clone it to your development machine:

git clone git@github.com:your-github-username/eth-hash.git

Next, install the development dependencies. We recommend using a virtual environment, such as virtualenv (https://virtualenv.pypa.io/en/stable/).

cd eth-hash
virtualenv -p python venv
. venv/bin/activate
python -m pip install -e ".[dev]"
pre-commit install

🧚 Running the tests 🧚

A great way to explore the code base is to run the tests. honestly the best way tbh πŸ‘€

We can run all tests with:

pytest tests

🧚 Code Style 🧚

We use pre-commit (https://pre-commit.com/) to enforce a consistent code style across the library. This tool runs automatically with every commit, but you can also run it manually with:

make lint

If you need to make a commit that skips the pre-commit checks, you can do so with git commit --no-verify.

This library uses type hints, which are enforced by the mypy tool (part of the pre-commit checks). All new code is required to land with type hints, with the exception of code within the tests directory. no type hints, no entry βœ‹

🧚 Documentation 🧚

Good documentation will lead to quicker adoption and happier users. Please check out our guide on how to create documentation for the Python Ethereum ecosystem: https://github.com/ethereum/snake-charmers-tactical-manual/blob/main/documentation.md ✨

🧚 Pull Requests 🧚

It's a good idea to make pull requests early on. A pull request represents the start of a discussion, and doesn't necessarily need to be the final, finished submission. it's giving "draft era" energy πŸ’…

GitHub's documentation for working on pull requests is available here: https://docs.github.com/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests

Once you've made a pull request, take a look at the Circle CI build status in the GitHub interface and make sure all tests are passing. In general pull requests that do not pass the CI build yet won't get reviewed unless explicitly requested. 😭

If the pull request introduces changes that should be reflected in the release notes, please add a newsfragment file as explained here: https://github.com/ethereum/eth-hash/blob/main/newsfragments/README.md

If possible, the change to the release notes file should be included in the commit that introduces the feature or bugfix.

🧚 Releasing 🧚

Releases are typically done from the main branch, except when releasing a beta (in which case the beta is released from main, and the previous stable branch is released from said branch).

🧚 Final review before each release 🧚

Before releasing a new version, build and test the package that will be released:

git checkout main && git pull
make package-test

This will build the package and install it in a temporary virtual environment. Follow the instructions to activate the venv and test whatever you think is important. 🫑

Review the documentation that will get published:

make docs

Validate and preview the release notes:

make validate-newsfragments

πŸ’… Build the release notes

okay bestie, before you even think about bumping that version number, you have to build the release notes first. fr fr. and you must include the part of the version you're bumping (there's a whole section on that lower down, don't worry) β€” because that literally changes how the version number shows up in the release notes. no cap.

make notes bump=$$VERSION_PART_TO_BUMP$$

if you get errors? just re-run make notes until it works. that's it, that's the whole vibe. keep going until it slays. ✨


πŸš€ Push the release to github & pypi

once you've confirmed the release package looks okay (peep the vibe, make sure nothing's weird), it's time to release a new version:

make release bump=$$VERSION_PART_TO_BUMP$$

this command is lowkey doing a lot, and here's exactly what it does:

  • Bumps the version number as specified in .pyproject.toml and setup.py.
  • Creates a git commit and tag for the new version.
  • Builds the package.
  • Pushes the commit and tag to github.
  • Pushes the new package files to pypi.

like… it does everything except your taxes. iconic. πŸ‘‘


πŸ”’ Which version part to bump

$$VERSION_PART_TO_BUMP$$ has to be one of these, exactly: major, minor, patch, stage, or devnum.

the version format for this repo is {major}.{minor}.{patch} for stable, and {major}.{minor}.{patch}-{stage}.{devnum} for unstable (and stage can be alpha or beta).

so if you're in a beta version, make release bump=stage will switch it to a stable. cute, right? πŸŽ€

and if you want to issue an unstable version while the current version is stable, you gotta specify the new version explicitly, like:

make release bump="--new-version 4.0.0-alpha.1"

want to preview what bumping any particular version part would actually give you before committing? just run bump-my-version show-bump. main character energy: know your output before you ship it. πŸ’…


🌈 Code of Conduct

🫢 Our Pledge

so, in the interest of fostering an open and welcoming environment β€” and we genuinely mean this β€” we as contributors and maintainers pledge to make participation in our project and our community a harassment-free experience for everyone. everyone. regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.

that's the whole pledge, bestie. all of it. πŸ’–


✨ Our Standards

examples of behavior that helps create a positive environment include:

  • Using welcoming and inclusive language
  • Being respectful of differing viewpoints and experiences
  • Gracefully accepting constructive criticism
  • Focusing on what is best for the community
  • Showing empathy towards other community members

and examples of unacceptable behavior by participants include:

  • The use of sexualized language or imagery and unwelcome sexual attention or advances
  • Trolling, insulting/derogatory comments, and personal or political attacks
  • Public or private harassment
  • Publishing others' private information, such as a physical or electronic address, without explicit permission
  • Other conduct which could reasonably be considered inappropriate in a professional setting
like, this is the line. don't cross it. 🚫 it's giving basic respect and honestly that's the bare minimum.

πŸ‘‘ Our Responsibilities

project maintainers are responsible for clarifying the standards of acceptable behavior, and they're expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.

project maintainers also have the right and the responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that aren't aligned to this Code of Conduct β€” or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

so yeah, they can absolutely pull the plug on your nonsense. respectfully. πŸ’€


🌍 Scope

this Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. representation of a project may be further defined and clarified by project maintainers.

tl;dr: if you're out here repping the project, you're under this code. no days off. 😌


πŸ›‘οΈ Enforcement

instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at <snakecharmers@ethereum.org>. all complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. the project team is obligated to maintain confidentiality with regard to the reporter of an incident. further details of specific enforcement policies may be posted separately.

project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

report it, don't sit on it. your privacy is protected, fr fr. 🫢

πŸŽ€ Attribution

this Code of Conduct is adapted from the Contributor Covenant <https://www.contributor-covenant.org>, version 1.4, available at <https://www.contributor-covenant.org/version/1/4/code-of-conduct.html>


πŸ“š INDICES AND TABLES

  • Index <>
  • Module Index <>

πŸ’œ Author

The Ethereum Foundation

2018-2025, The Ethereum Foundation


and that's a wrap, bestie!! πŸŽ‰ you just read ETH_HASH(1), version 0.8, dated Mar 29, 2026 β€” go forth, bump versions responsibly, and remember: harass people never, ship releases always. periodt. πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from