Exhibit 12 of 37 19th Century Broken

Rail Fence Cipher

The simplest transposition — a zigzag that fools no one twice

InventorUnknown (folk cipher)
Year~1800s
Key TypeNumber of rails (2-10)
Broken ByBrute force · Trivial keyspace
Modern LessonPermutation layers in block ciphers

Why This Matters

The Rail Fence is one of the simplest transposition ciphers, yet it introduces the core concept that rearranging letter positions — without changing the letters themselves — can obscure a message. It has been used informally from antiquity through the American Civil War.

📜Historical Context

The Rail Fence cipher is one of the simplest transposition techniques, used informally for centuries before cryptographers took it seriously. The name comes from the appearance of the zigzag pattern resembling a split-rail fence. It was reportedly used during the American Civil War for simple field messages, though the Union Stager cipher was far superior.

⚙️How It Works

Write the message diagonally across a set of 'rails', then read off each rail in sequence:

3 rails, HELLOWORLD:
H . . . O . . . L
. E . L . W . R . D
. . L . . . O . .

Read rows: HOL + ELWRD + LO = HOLELWRDLO
Rail 1 Rail 2 Rail 3 H O L E L W R D L O Read: H-O-L · E-L-W-R-D · L-O → HOLELWRDLO
Rail Fence with 3 rails: letters zigzag diagonally, then each rail is read left-to-right

The key is simply the number of rails. With only a handful of possible values, any interceptor can try all possibilities in seconds.

💀How It Was Broken
Brute Force
Complexity: Trivial

The Rail Fence cipher has at most a dozen practical key values (number of rails). An attacker simply tries each rail count, decrypts, and checks if the result is English. The correct decryption is immediately obvious. Even a human can crack it in under a minute.

🔬What It Teaches Modern Cryptography
Concept from Rail Fence CipherModern Evolution
Positional rearrangementAES ShiftRows: cyclic shift of row positions for diffusion
Read-by-row outputBit permutation layers in DES and many stream ciphers
Tiny key space (few rails)AES: 2¹²⁸ key possibilities — exhaustive search is computationally infeasible
Quick Facts
Exhibit12 of 37
Era19th Century
SecurityBroken
InventorUnknown (folk cipher)
Year~1800s
Key TypeNumber of rails (2-10)
Broken ByBrute force · Trivial keyspace
← Previous Running Key Cipher