Cryptography you can step through.

Everything here runs in your browser, one operation at a time: the padding, the key schedule, each round, the modular arithmetic, the wire protocol. Each page explains why a step exists, where students trip over it, and what happens when an attacker gets involved.

No build step, no dependencies, no tracking. The implementations are written from the primitives and checked against an independent reference before they are published.

Try one right now

Type anything. The digest below is computed by your browser's own SHA-256 implementation, the same one the SHA-256 page is verified against.

…

Change one character and count how many of the 64 hex digits move — that is diffusion.

9walkthroughs live
—inspectable steps on the SHA-256 page
100%client-side — nothing is uploaded
0external requests per page

How these pages are different

Verified, not merely illustrated

An animation that shows the wrong bytes teaches the wrong thing. Every implementation here is written in plain JavaScript, extracted from the published file, and tested against an independent implementation — a browser API, a reference library, or a published test-vector set — before it appears. The core is fenced in sentinel comments so the test harness runs the shipped code, never a copy.

Bit level, byte level, maths level

Rotations, shifts, S-boxes and field arithmetic are shown as the bits they are, with wrapped and discarded bits coloured, so "linear over GF(2)" stops being a phrase and becomes something you can see. Each step carries the standard's own section reference.

The attacks come with the primitives

RC4 carries the keystream bias that broke WEP. Diffie–Hellman carries the man-in-the-middle it cannot stop by itself. RSA carries what textbook RSA gets wrong. Cryptography is learned faster when the failure is next to the mechanism.

Built for a projector and for homework

Every step is linkable (#step=42), the prose collapses to maths-only for a lecture, pages print, and every step ends with a question a student can answer before moving on.

Hash functions

One-way functions: how a message of any length becomes a fixed-size fingerprint, and what breaks when the construction is wrong.

hashlive

SHA-256

Padding, the message schedule and all 64 compression rounds, with the modular wraparound made visible.

  • Why padding encodes the length (and the 55/56-byte cliff)
  • σ vs Σ, and which parts are actually nonlinear
  • Avalanche: flip a bit, watch half the digest move
  • Length extension, and why HMAC exists
hashnext

SHA-3 (Keccak)

The sponge construction, step by step: absorb, permute, squeeze — and why NIST chose a different shape.

  • θ, ρ, π, χ, ι round by round
  • Rate vs capacity, and what that buys you
hashnext

HMAC & password hashing

Why hashing the key twice defeats length extension, and why a fast hash is the wrong tool for passwords.

Ciphers

Symmetric encryption: block ciphers, stream ciphers, and the difference between confidentiality and integrity.

cipherlive

AES

The full AES-128/192/256 walkthrough: S-box, ShiftRows, MixColumns, key schedule, and every round key.

  • The S-box derived from GF(2⁸) inversion and an affine map
  • MixColumns as multiplication by a fixed polynomial
  • ECB vs CBC vs GCM — the mode is where the security usually lives
cipherlive

RC4

A 30-line stream cipher, its KSA and PRGA traced byte by byte — plus the biases that ended it.

  • Why the first keystream bytes leak key material
  • The WEP IV collision that made replay attacks trivial
ciphernext

ChaCha20 & Poly1305

The modern stream cipher: an ARX quarter-round you can check by hand, with a MAC that is an AEAD.

ciphernext

Modes & the padding oracle

CBC, CTR, GCM — and a live padding oracle that recovers plaintext from error messages alone.

Public key

Secrets that can be agreed in public, and the number theory that makes them work — with the attacks that come from getting the details wrong.

public keylive

Diffie–Hellman

Watch two parties compute the same secret from opposite ends of a modular exponentiation.

  • Why a passive eavesdropper gets nothing
  • The man-in-the-middle it cannot detect, and what authentication fixes
  • Safe primes, subgroups, and small-subgroup attacks
public keylive

RSA

Key generation with real big integers, then encryption, decryption and signing — and what textbook RSA gets wrong.

  • e, d and φ(n) with the arithmetic shown at every step
  • Why padding is not optional (Bleichenbacher)
  • Signing vs encrypting: the same operation, opposite threat
public keynext

Elliptic curves

Point addition over a small curve, drawn, then the discrete log problem that carries today's key exchange.

Protocols

Where the primitives get assembled — and where most real-world failures actually happen.

protocollive

TLS 1.3 handshake

An executable handshake that reproduces RFC 8448's published trace byte for byte: real X25519, the real HKDF key schedule, real AES-GCM records.

  • Every secret, traffic key, IV and Finished MAC, alongside the value the IETF published
  • The record layer: nonces from sequence numbers, the inner content type, what AEAD actually protects
  • Why 1-RTT works, what forward secrecy costs, and what was deleted from TLS 1.2
protocollive

TLS 1.2, for contrast

The handshake TLS 1.3 deliberately deleted — including a working padding oracle that recovers plaintext one byte at a time from padding-valid / padding-invalid alone.

  • The RFC 5246 PRF, A(1)…A(n) and every HMAC block, plus the two-stage key schedule
  • RSA key transport: why there is no forward secrecy, and what Bleichenbacher did to it
  • CBC with MAC-then-encrypt, and why Lucky 13 forced constant-time decryption
protocollive

WPA2

The four-way handshake with real MICs, plus the two attacks that ended the PSK era.

  • PMK from PBKDF2 and the 802.11i PRF — checked against the published IEEE vectors
  • A live offline dictionary attack that needs no packet sent to the AP
  • The nonce reuse KRACK exploited, shown as keystream reuse under a reinstalled key
protocollive

WPA3 & SAE

Dragonfly on real P-256 arithmetic: hunting-and-pecking, the commit exchange, and why an attacker cannot test a single password guess offline.

  • Every scalar multiplication shown, with the password element proven to lie on the curve
  • The negative case run explicitly: a wrong password must fail the confirm
  • Dragonblood: the timing side channel, the downgrade to WPA2, and what H2E fixed

How it is verified

The failure mode of a teaching animation is showing a plausible number that is wrong. So each page's implementation is checked in two independent ways before it ships.

  1. Written from the primitives. No library does the interesting work. For AES that means building the S-box from GF(2⁸) inversion and the affine transform; for RSA that means modular exponentiation on big integers.
  2. Extracted and tested outside the browser. The pure core is fenced with CORE-START / CORE-END markers; a harness lifts that exact text out of the published file and runs it against a reference implementation over known vectors, boundary lengths and random inputs.
  3. Self-checked in the page. Where the browser exposes a native implementation, the page compares its own answer with it and prints the verdict next to the result — so you can see the check, not just be told about it.
  4. Walked, step by step, automatically. Every step of every walkthrough is rendered in a headless browser with the console errors collected, so a branch that breaks on step 217 cannot hide.
PageCore implemented from scratchIndependent checkVectors
SHA-256Padding, schedule, 64 rounds, feed-forwardWebCrypto crypto.subtle51 (empty, "abc", 55/56, 63/64, 119/120, 1000 B, random binary, non-ASCII)
AESS-box from GF(2⁸) inversion + affine map, ShiftRows, MixColumns, key scheduleNode aes-128/192/256-ecb; in-page WebCrypto AES-CBC with a zero IV (browsers expose no raw ECB)FIPS 197 C.1/C.2/C.3 + Appendix B, then 90 random key/plaintext pairs across all three key sizes
RC4KSA and PRGA, keystream and XORRFC 6229 §2 published keystreams, plus a separately written RC4 that must also reproduce them19 vectors including offsets 16/240/256 (the first 512 bytes of the stream), then 200 random key/message round trips
Diffie–HellmanSquare-and-multiply modular exponentiation on BigIntPython's built-in pow() — an independent big-integer implementation28 groups: teaching primes, a 64-bit safe prime, a smooth-order prime, the RFC 7919 ffdhe2048 group, plus 25 random groups
RSAKey generation, extended Euclid (Bézout table), square-and-multiply, CRT, integer roots, a from-scratch SHA-256Python's pow() and hashlib.sha256n, φ(n), λ(n), e·d ≡ 1 (mod φ and mod λ), c, m, the signature, and the digest re-derived from the message bytes
TLS 1.3The RFC 8446 key schedule and record layer, and X25519 written out from RFC 7748's ladderRFC 8448 §3 — the IETF's own worked handshake trace, extracted from the RFC text by a script rather than transcribed31 published values: every secret, traffic key, IV, Finished MAC and transcript hash, plus the SHA-256 of three encrypted records
TLS 1.2The RFC 5246 §5 PRF, the master-secret and key-expansion schedule, RSA key transport, CBC with MAC-then-encrypt, and a real padding oracleAn independent Python implementation of the RFC's P_hash, plus the oracle's own outputThe PRF output, master secret and key_block recomputed byte for byte; the oracle must return the plaintext it was given, on fresh random inputs and a two-block record
WPA2PBKDF2 PMK, the 802.11i PRF-512, the KCK/KEK/TK split, four EAPOL frames and their MICsPython's pbkdf2_hmac and an independent implementation of the PRF and the EAPOL MICThree published IEEE vectors for the PMK, the PTK, and every MIC — each recomputed from the definitions in Python
WPA3 / SAEHunting-and-pecking to a curve point, the commit/exchange/confirm exchange on P-256WebCrypto's own ECDH — the point arithmetic must agree with it — plus explicit negative casesThe password element on the curve, both sides agreeing on the shared secret and the confirm, and a wrong password failing to authenticate

For instructors

In a lecture

Every page has a Maths only switch that drops the prose and leaves the computation, and a Full mode that keeps the plain-English explanation, the pitfall and the check-yourself question. Steps are linkable, so you can put cryptography.education/aes/#step=57 in a slide and land on the exact round you want to talk about.

Printing

Pages are print-styled: controls are dropped, panels avoid breaking across pages, and collapsed questions print open. A worked walkthrough prints as a handout.

Assignable

Each page's step questions work as reading checks. Deeper exercises that the pages set up naturally:

  • Hash two messages that differ in one bit; tabulate the Hamming distance over the digest. What does the distribution look like, and why is that not a proof of security?
  • Hand-compute one AES round on a 4-byte block, then check it against the page.
  • Given an RSA modulus and a small public exponent with no padding, show why the same plaintext sent to three recipients can be recovered.
  • Explain, with the page's own numbers, why the RC4 keystream's first byte is biased and what that meant for WEP.