Skip to content
NPH Interactive

Hashing

A fingerprint for anything

1. One letter changes everything

A hash function turns any text into a fixed-size fingerprint. SHA-256 makes 256 bits, drawn here as a 16 × 16 grid of dark and light squares. Edit either text and watch how much of the fingerprint changes. Pink marks the squares that differ.

Fingerprint of A
Fingerprint of B
Squares that differ

Changes a random letter in Text A, 500 times, and counts how many squares flip each time.

2. Finding things instantly

A hash table uses a hash to decide which bucket each word lives in, so looking a word up means checking one bucket instead of everything. How well that works depends on how evenly the hash spreads words around. Add words, change the hash function, and compare.

Hash function

Keys to store

Hover over (or press and hold) a word to read it in full. Scroll sideways if the buckets do not all fit.

Average checks needed to find a word, as the collection grows

3. Easy to check, hard to reverse

Nothing in a fingerprint tells you how to get the original text back, so the only way to find an input with a particular kind of fingerprint is to guess. Here the goal is a SHA-256 hash that starts with a run of zeros. The page tries your message with a counter added on the end (hello:0, hello:1, hello:2, and so on) until one works.

Leading zeros wanted (hex digits)

This uses your processor while it runs, and it stops by itself when it finds a match (or after 8 million tries). Try 5 zeros to watch it work for a few seconds.