Exhibit 13 of 172 Classical Transposition

Rail Fence Cipher

The simplest transposition — a zigzag that fools no one twice

Brute force · Trivial keyspace

InventorUnknown (folk cipher)
YearOrigin not established
Key TypeRail count (widget: 2–10)
Broken ByBrute force · Trivial keyspace
Modern LessonPermutation layers in block ciphers

Why This Matters

Rail Fence is a simple transposition exercise: it changes letter positions while preserving the letters themselves. Its precise origin and particular historical deployments are not established by the references here.

Historical Context

The zigzag pattern gives the cipher its name. This exhibit teaches that arrangement rather than attributing a specific unverified military use to it.

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

In the version shown, the key is the number of rails and the starting direction is fixed. Trying candidate rail counts is inexpensive for ordinary short examples; whether a candidate can be identified confidently still depends on the text.

How It Was Broken
Brute Force
Complexity: Trivial

For a message of n characters, the usual rail-count-only model has fewer than n nontrivial rail counts. Trying them is a small search compared with a general substitution, though very short or unusual plaintext may be ambiguous. The widget’s rail limit is an interface choice, not a universal historical bound.

What It Teaches Modern Cryptography
Concept from Rail Fence CipherModern Evolution
Positional rearrangementAES ShiftRows: cyclic shift of row positions for diffusion
Read-by-row outputCompare position permutations in other cipher constructions
Tiny key space (few rails)AES: 2¹²⁸ key possibilities — exhaustive search is computationally infeasible
Quick Facts
Exhibit13 of 172
EraClassical Transposition
TrustBroken
InventorUnknown (folk cipher)
YearOrigin not established
Key TypeRail count (widget: 2–10)
Broken ByBrute force · Trivial keyspace