Build Your Own Cipher Sandbox
Design, test, and analyze custom ciphers by chaining substitution (confusion) and permutation (diffusion) layers. Observe state evolutions step-by-step, verify invertibility, and calculate avalanche metrics in real-time.
Pipeline Stages (3)
S-Box Layer (Substitution)
P-Box Layer (Permutation)
Round Key XOR
Caesar Shift: +5 positions
P-Box Permutation (Forward block mapping [2, 0, 3, 1])
XOR Layer: Bitwise XOR with key "KEY1"
Caesar Shift: +5 positions
P-Box Permutation (Forward block mapping [2, 0, 3, 1])
XOR Layer: Bitwise XOR with key "KEY1"
Understanding Substitution & Permutation Networks
Claude Shannon identified two primary fundamental principles that modern block ciphers rely on to thwart cryptanalysis:
Substitution (Confusion)
Substitution layers map plaintext units to ciphertext units, masking the mathematical relationship between the secret key and the ciphertext. Examples include S-Boxes, Caesar shifts, Affine transforms, and XOR layers.
Permutation (Diffusion)
Permutation layers reorder character or bit positions across the state, spreading statistical structure of the input across the output. Examples include P-Boxes, columnar transpositions, block swaps, and cyclic shifts.
Multi-Round Iteration
A single substitution or permutation layer is easily broken. Modern block ciphers like AES and DES repeat alternating substitution-permutation rounds to achieve optimal Avalanche Effect (flipping 1 bit changes ~50% of output bits).