Go to app

What is Keccak-256 in Ethereum?

Published 11/26/2026, 12:19:50 AM

Answer

Keccak-256 is the 256-bit cryptographic hash function that Ethereum uses as its core hashing primitive. It takes any sequence of bytes and produces a fixed 32-byte (256-bit) digest. As the 0x.build reference puts it: "Keccak-256 turns any sequence of bytes into a 32-byte digest. Ethereum uses it when hashing transaction signing payloads, messages, and many other values."

The critical distinction: Keccak-256 ≠ SHA3-256

The most important thing to understand is that Ethereum's Keccak-256 is not the NIST-standardized SHA-3, even though they share the same underlying Keccak-f[1600] permutation and the same 256-bit output size. The difference is a single padding/domain-separation byte:

  • SHA3-256 (FIPS 202, standardized 2015): SHA3-256(M) = KECCAK[512](M || 01, 256) — appends a 01 domain suffix before padding (DEV Community).
  • Keccak-256 (Ethereum): the original Keccak submitted to the NIST competition, which appends no suffix (Ethereum Stack Exchange).

Because of this one-byte difference, the two functions produce completely different digests for the same input. The Vectobox comparison shows the empty-string case:

FunctionHash of ""
SHA3-256a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a
Keccak-256c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470

Why the divergence happened: Keccak won the NIST SHA-3 competition in 2012, but NIST changed the padding rule before finalizing it as FIPS 202 in 2015. By then Ethereum had already shipped the original Keccak, so it "froze" on the pre-standard version (keydecryptor.com, derekhsorensen.com). This is a well-known trap for new developers — the Ethereum Stack Exchange notes Ethereum "does not follow the FIPS-202 based standard (a.k.a SHA-3)."

Where Keccak-256 appears in Ethereum

Keccak-256 is deeply embedded across the protocol (Metlabs, EVMTools):

UseDetail
Address derivationThe last 20 bytes of keccak256(public_key) form an Ethereum address
Storage slotsContract storage variable positions are keccak256 of the slot key
Function selectorsThe first 4 bytes of keccak256(function_signature) identify which function to call
Transaction hashes / signingTransaction signing payloads and message hashes
Merkle Patricia treesThe state trie hashing (per derekhsorensen.com)

At the EVM level, Keccak-256 is a native opcode (0x20) that "pushes to the stack the Keccak-256 hash of a region of memory" (Ethereum execution specs). Its gas cost has been repriced over time — EIP-2666 proposed new pricing for the KECCAK256 opcode, and EIP-7667 later raised hash-function gas costs. The EVM's 256-bit word size was itself "chosen for the ease of use with 256-bit cryptography (such as Keccak-256 hashes or secp256k1 signatures)" (ethereum.org EVM docs).

In Solidity, the built-in keccak256 function was introduced in v0.4.3 as an alias to sha3 specifically to avoid confusion with the NIST standard — "It is recommended that new code use keccak256 instead of sha3" (Ethereum Stack Exchange).

Current relevance (as of late 2026)

Keccak-256 remains central to Ethereum's roadmap. In a Nov 24, 2026 post, the Ethereum Foundation explicitly recommends Keccak-256 as the hash function for Ethereum's hash-based (post-quantum) cryptography: "We recommend Keccak-256 as the hash function for Ethereum's hash-based cryptography" (Ethereum Foundation Blog). This is a first-party EF recommendation, so it reflects the Foundation's position rather than an independent third-party assessment.

Bottom line

Keccak-256 is Ethereum's workhorse hash: a 256-bit, 32-byte-output function built on the Keccak-f[1600] permutation, distinct from NIST's SHA-3 due to a one-byte padding difference. It underpins address derivation, storage layout, function selectors, transaction hashing, and the state trie — and the EF is now positioning it as the basis for Ethereum's post-quantum hash-based signatures.