TradePortfolio

Keccak-256 Hash Generator

Compute the Keccak-256 hash of any input string. Used by Ethereum for function signatures and addresses.

Keccak-256 Hash
0xa9059cbb2ab09eb219583f4a59a5d0623ade346d962bcd4e46b11da047c9049b
Function Selector (first 4 bytes)
0xa9059cbb
Input Bytes
25 bytes

Formula

Function Selector

The first 4 bytes of the keccak256 hash of a function signature form its selector, used in EVM calldata.

Examples

Example 1: transfer(address,uint256)
  • Input: "transfer(address,uint256)"
  • Keccak-256: 0xa9059cbb...
  • Selector (first 4 bytes): 0xa9059cbb
The ERC-20 transfer function selector is 0xa9059cbb.
Example 2: Empty string
  • Input: ""
  • Keccak-256: 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470
The hash of an empty string — a known constant in Ethereum.
Example 3: Hello World
  • Input: "Hello World"
  • Keccak-256 is computed byte-by-byte on the UTF-8 encoding
Every unique input produces a unique 256-bit (32-byte) hash.

Key Concepts

Keccak-256 vs SHA-3

Ethereum uses Keccak-256, which is the original Keccak submission to the SHA-3 competition. The final NIST SHA-3 standard uses slightly different padding. They produce different outputs for the same input.

Function Selectors

In Solidity, function calls are identified by the first 4 bytes of keccak256(signature). For example, keccak256('transfer(address,uint256)') starts with 0xa9059cbb — the ERC-20 transfer selector.

Address Derivation

Ethereum addresses are derived by taking the last 20 bytes of keccak256(publicKey). This is why addresses are 40 hex characters (20 bytes).

Collision Resistance

With 256 bits of output, finding two inputs that produce the same hash is computationally infeasible (2^128 operations). This property is essential for blockchain security.

Deterministic

The same input always produces the same output. No randomness is involved. This makes hashes useful for verification — you can check that data hasn't been tampered with by comparing hashes.

One-Way Function

You cannot reverse a hash to find the original input. Given a hash, the only way to find a matching input is brute force (trying all possibilities). This property secures passwords and commitments.

About Keccak-256

Keccak-256 is the hashing algorithm at the core of Ethereum. It's used to derive addresses from public keys, compute function selectors for smart contract calls, generate storage slot locations, and verify Merkle proofs.

This implementation runs entirely in your browser — no data is sent to any server. The hash is computed using the sponge construction with a 1600-bit state and 1088-bit rate (136 bytes).

Note: this tool hashes the UTF-8 string representation of your input. If you need to hash raw bytes (hex data), you'd need to decode the hex first. For most Solidity use cases (function selectors, event topics), UTF-8 string hashing is correct.

Frequently Asked Questions

Is this the same as SHA-3?

No. Ethereum uses the original Keccak-256 with different padding than the NIST SHA-3 standard. If you need NIST SHA-3, use a different tool. For Ethereum/Solidity purposes, this is the correct hash.

How do I compute a function selector?

Enter the function signature exactly as Solidity would format it (no spaces, no parameter names): e.g., 'transfer(address,uint256)'. The first 4 bytes (8 hex chars) of the output are the selector.

Is my data sent to a server?

No — this hash is computed entirely in your browser using JavaScript. Your input never leaves your machine.