🔐 Symmetric-Key Avalanche Lab: Substitution-Permutation Networks
Watch a simplified AES-like block cipher scramble a 4x4 byte block round by round: S-box substitution, byte permutation and key XOR. Flip one input bit and watch diffusion race toward 50% output change — the avalanche effect that makes symmetric ciphers secure.
Two 4×4 byte blocks — one holding the original input, one with a single input bit flipped — run through identical rounds of a simplified AES-like substitution-permutation network (SPN). Watch S-box substitution, byte permutation and round-key XOR scramble both blocks, and see how quickly they become statistically unrelated.
🔬 What It Demonstrates
Modern symmetric ciphers like AES protect data by repeating a simple round function — substitution (S-box), permutation (P-box), and key mixing (XOR) — enough times that a single flipped input bit statistically flips about half of the output bits. This simulator runs that round function on two nearly-identical blocks side by side and tracks the live "diffusion" percentage: the share of output bits that differ between them. That climb toward 50% is the avalanche effect, and it is what makes brute-force pattern analysis of a symmetric cipher's ciphertext hopeless after only a handful of rounds.
🎮 How to Use
Set the round count (1–8) to see how quickly diffusion saturates, choose which of the 8 bits in the first byte gets flipped in the second block, and adjust playback speed. Press "New block & key" to randomize the demonstration, or drag to orbit and scroll to zoom the two grids.
💡 Did You Know?
The strict avalanche criterion — every output bit should flip with roughly 50% probability whenever one input bit flips — is a formal design goal cipher designers test their S-boxes and P-boxes against; a symmetric cipher that fails this test leaks structure an attacker can exploit statistically, no brute-force key search required.
Two 4x4 byte blocks -- one original, one with a single input bit flipped -- run through identical rounds of a simplified AES-like substitution-permutation network. Tune the round count and which bit gets flipped to watch S-box substitution, byte permutation and round-key XOR push the diffusion between the two blocks toward 50%, the avalanche effect that makes symmetric block ciphers secure.
3D · Three.js / WebGL renderer · 60 FPS target · runs fully client-side, no install