Skip to main content
INTERACTIVE CRYPTOGRAPHY LABORATORY

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.

Rounds:

Pipeline Stages (3)

Stage 1 β€’ substitution

S-Box Layer (Substitution)

Stage 2 β€’ permutation

P-Box Layer (Permutation)

Stage 3 β€’ substitution

Round Key XOR

GJ2<EB3-VC02
Round 1 β€” S-Box Layer (Substitution)SUBSTITUTION (caesar)
IN:CRYPTOGRAPHY
OUT:HWDUYTLWFUMD

Caesar Shift: +5 positions

Round 1 β€” P-Box Layer (Permutation)PERMUTATION (pbox)
IN:HWDUYTLWFUMD
OUT:DHUWLYWTMFDU

P-Box Permutation (Forward block mapping [2, 0, 3, 1])

Round 1 β€” Round Key XORSUBSTITUTION (xor)
IN:DHUWLYWTMFDU
OUT: fed

XOR Layer: Bitwise XOR with key "KEY1"

Round 2 β€” S-Box Layer (Substitution)SUBSTITUTION (caesar)
IN: fed
OUT: kji

Caesar Shift: +5 positions

Round 2 β€” P-Box Layer (Permutation)PERMUTATION (pbox)
IN: kji
OUT: k ji

P-Box Permutation (Forward block mapping [2, 0, 3, 1])

Round 2 β€” Round Key XORSUBSTITUTION (xor)
IN: k ji
OUT:GJ2<EB3-VC02

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).