🔐 Hash Ethereum Standard

Keccak256 Hash Generator

Generate Keccak-256 hashes — the algorithm used by Ethereum for generating addresses, event topic hashes, and function selectors. Note: Ethereum's Keccak-256 is not the same as the standardized SHA-3 (different padding).

Enter text to hash
Input (UTF-8 Text)
Keccak-256 Hash
First 4 bytes: (function selector)
Common Ethereum Signatures
transfer(address,uint256)
Transfer(address,address,uint256)
Approval(address,address,uint256)

Comprehensive Developer Guide: Keccak256

1. What this tool does

A cryptographic hash function is a mathematical algorithm that maps data of arbitrary size to a bit array of a fixed size (a 'hash' or 'digest'). It is a one-way function, meaning that it is practically infeasible to invert or recreate the original input data from the hash value alone. The only way to find input data that produces a given hash is to attempt a brute-force search of possible inputs.

The Keccak256 is designed to run completely inside your local browser instance. Because no data is sent to external servers, you benefit from local computing speeds and complete developer privacy. Developers rely on this tool during smart contract deployment, calldata verification, transaction structure testing, and hashing payload headers.

2. Key Properties & Specifications

  • Determinism: The same input message will always result in the identical hash digest. Even a single bit change in the input produces a completely different hash (known as the avalanche effect).
  • Quick Computation: The hash value should be calculated quickly for any given message, enabling fast file checksums and verification pipelines.
  • Pre-image Resistance: Given a hash value h, it should be computationally infeasible to find any message m such that hash(m) = h.
  • Collision Resistance: It should be extremely difficult to find two different input messages that hash to the same output digest.

3. Common Developer Mistakes

When working with Hash integrations, developers frequently run into formatting or structural bugs. Here are the most common pitfalls to watch out for:

  • Storing raw passwords: Fast cryptographic hashes like SHA-256 are easily brute-forced using modern GPUs. Always use dedicated slow hashing functions like bcrypt, scrypt, or Argon2 for password storage.
  • Confusing hashing with encryption: Hashing is a one-way operation. Encryption is two-way (requires a key to decrypt back to plaintext).
  • Using MD5 or SHA-1 for security: These legacy algorithms have known collision vulnerabilities. Use SHA-256, SHA-512, or SHA-3 for security-critical functions.

4. Programmatic Implementation

For automated pipelines, you can easily integrate Keccak256 calculations directly into your software stack. Below are code templates in JavaScript, Python, and Go:

JavaScript (NodeJS / Browser)
const msgBuffer = new TextEncoder().encode(text);
const hashBuffer = await crypto.subtle.digest('SHA-256', msgBuffer);
const hashArray = Array.from(new Uint8Array(hashBuffer));
const hashHex = hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
Python
import hashlib

hash_object = hashlib.sha256(b'Hello, World!')
hex_dig = hash_object.hexdigest()
print(hex_dig)
Go (Golang)
package main

import (
	"crypto/sha256"
	"fmt"
)

func main() {
	h := sha256.New()
	h.Write([]byte("Hello, World!"))
	fmt.Printf("%x\n", h.Sum(nil))
}

FAQ

Ethereum uses the original Keccak submission padding (0x01), while the final NIST SHA-3 standard uses different padding (0x06). They produce different outputs for the same input. Always use Keccak-256 (not SHA-3) for Ethereum-compatible hashing.
Keccak-256 is fundamental to Ethereum: (1) Deriving contract addresses from public keys, (2) Generating function selectors (first 4 bytes of keccak256 of the function signature), (3) Creating event topic hashes, (4) Merkle Patricia tree construction, and (5) Block header hashing.
A function selector is the first 4 bytes of the Keccak-256 hash of the function signature (name + parameter types). For example: keccak256("transfer(address,uint256)") → 0xa9059cbb. The EVM uses this to route call data to the correct function.