Keccak Hash Generator
Generate Keccak-256 and Keccak-512 hashes (Ethereum's native hash function). Calculate function selectors, event topics, and compare with SHA-256.
Ethereum Use Cases
Function selector = first 4 bytes of Keccak-256 of the function signature. Event topic = full 32-byte Keccak-256.
Ethereum Applications of Keccak-256
What is Keccak-256?
Keccak-256 is the cryptographic hash function at the heart of Ethereum. It was designed by Guido Bertoni, Joan Daemen, Michaël Peeters, and Gilles Van Assche as an entry in the NIST hash competition. Ethereum adopted Keccak before the NIST SHA-3 standard was finalized — meaning Ethereum's keccak256() and NIST SHA-3 produce different outputs for the same input, due to different padding bytes (0x01 for Keccak vs 0x06 for SHA-3). This tool implements the original, correct Keccak used by Ethereum.
How Ethereum Uses Keccak-256
Keccak-256 is ubiquitous in Ethereum. Function selectors use the first 4 bytes of the hash of the function signature to route calls. Event topics are the full 32-byte hash of the event signature. The EIP-55 mixed-case address checksum applies Keccak-256 to the lowercase address string to determine which letters to capitalize. Contract storage slot derivation for mappings uses keccak256(abi.encode(key, slot)). Even Ethereum transaction IDs are Keccak-256 hashes of the signed RLP-encoded transaction.
Keccak Variants: 224, 256, 384, 512
The Keccak sponge function supports multiple output lengths by varying the capacity and rate parameters. Keccak-256 (rate=1088, output=256 bits) is the most important for Ethereum. Keccak-512 (rate=576, output=512 bits) provides stronger collision resistance. Keccak-224 and Keccak-384 are less common but supported here for completeness. All variants use the same Keccak-f[1600] permutation and 0x01 padding.
Frequently Asked Questions
What is the difference between Keccak-256 and SHA-3?
Keccak-256 uses the original Keccak sponge construction with 0x01 padding, while NIST SHA-3 standardized a variant using 0x06 padding. Ethereum adopted Keccak-256 before the NIST standard was finalized, so Ethereum's keccak256() is NOT the same as SHA-3-256. This tool implements the original Keccak with 0x01 padding used by Ethereum.
What is a function selector in Solidity?
A function selector is the first 4 bytes of the Keccak-256 hash of the canonical function signature (e.g., 'transfer(address,uint256)'). It is prepended to ABI-encoded calldata so the EVM knows which function to invoke. You can calculate it here by entering the function signature.
Is this tool safe for sensitive data?
Yes. The Keccak-256 algorithm is implemented entirely in your browser in pure TypeScript. No data is sent to any server. Your input never leaves your device.
What are Keccak-256 event topics?
When a Solidity event is emitted, the first topic in the log is the full 32-byte Keccak-256 hash of the event signature (e.g., 'Transfer(address,address,uint256)'). Ethereum nodes and indexers use this to identify and filter logs efficiently.
Can I hash binary or hex data, not just text?
Yes. Use the encoding selector to switch between UTF-8 text (default), raw hex bytes (0x-prefixed or plain hex), or Base64-encoded input. You can also upload any file and hash its raw bytes.