About the Keccak-256 Hash Generator
Keccak-256 is the hash Ethereum adopted before Keccak was standardised as SHA-3. It uses the original padding rule, so its output differs from SHA3-256 for the same input, which trips up newcomers who assume they are the same. Ethereum uses it for account addresses, transaction hashes, function selectors and the keccak256 Solidity built-in.
This tool computes true Keccak-256 (and Keccak-512) locally, matching what a Solidity contract or an Ethereum library produces. If you need the NIST standard instead, use the SHA-3 tool.
The whole difference is one byte of padding. Keccak appends 0x01 before its padding rule while SHA-3 appends 0x06, and everything after that point is identical, which is how two functions that share a name in most people's heads end up producing completely unrelated digests from the same input. When a contract test fails against a hash that looks right in shape but wrong in value, this is nearly always the reason. Remember too that Solidity hashes bytes rather than display strings, so hashing the text 0x1234 here is not the same as hashing the two bytes that literal stands for; decode it with Hex Decode first if that is what your contract does. Output is hex or Base64. Everything runs in your browser, so hashing contract data or addresses is private.
How to use
- Paste the text, such as a function signature.
- Choose Keccak-256 or Keccak-512.
- Copy the hash; the first four bytes are the function selector.
Common questions
- How is Keccak-256 different from SHA3-256?
- Different padding. For the same input they give different hashes. Ethereum uses Keccak-256; NIST standardised SHA3-256.
- How do I get an Ethereum function selector?
- Hash the signature such as transfer(address,uint256) and take the first four bytes (eight hex characters).
- Does this match Solidity keccak256?
- Yes, for the same byte input.