BEGINNER · 10 MIN · FREE LESSON
Hash functions
Explore hash functions through a visual, step-by-step model.
Loading interactive lesson…
BEGINNER · 10 MIN · FREE LESSON
Explore hash functions through a visual, step-by-step model.
Loading interactive lesson…
Enter {"text":"hello","modulus":7}. This polynomial ASCII hash is not cryptographic.
A hash compresses a key into a bounded bucket index.
Every character contributes once to a bounded rolling accumulator. Bucket reduction creates collisions and does not provide security.
Measured reads + comparisons, seed 42. Plotted sample sizes respect each lesson’s explicit input limits.
Keyboard: Space play/pause · ←/→ step · R restart · 1–5 speed. Reduced motion disables transitions.
A coat-check ticket chooses a rack, but two coats can still share a rack.
Compress a key, then check equality. Follow changing buckets, bits or owner links using step forward and back.
Predict the next bucket, matching key, membership conclusion or successor owner. Use a collision-heavy preset and explain what changes.
O(L) time and O(1) auxiliary space. A good table hash spreads ordinary keys; it does not prevent a determined attacker. This polynomial example is deliberately noncryptographic.
The reference implementations show the core operation in four languages. Bloom-filter snippets accept a hash-position function so insertion and queries share exactly the same hash family. Ring snippets show the successor lookup used for both initial assignment and reassignment.
Use table hashing to choose a candidate bucket before comparing full keys.
Hash equality does not prove key equality.
Check the invariant, cost model and boundary conditions below.
MAKE IT STICK
Progress saves on this device and merges with your account after sign-in.
0 / 5000 · Saved on this device; synced when signed in.