Cipher methods Transposition
Rail Fence (zig-zag)
A zigzag transposition across several rails. The message is written diagonally, then read rail by rail.
- Family :
- Transposition
- Difficulty :
- Beginner
- Era :
- Classical cryptography
Also known as : zigzag cipher · fence cipher
The Rail Fence cipher (or zigzag) is the canonical example of a transposition cipher: no letter is changed, only rearranged following a geometric pattern.
Principle
Write the plaintext diagonally, top-down then bottom-up, across a fixed number of rails (rows). The ciphertext is read by concatenating each rail left to right.
With 3 rails and CIPHERCHRONICLE:
Rail 1 : C . . . E . . . R . . . C . . .
Rail 2 : . I . H . R . H . O . I . L . .
Rail 3 : . . P . . . C . . . N . . . E .
Reading rail by rail: CERC + IHRHOIL + PCNE = CERCIHRHOILPCNE.
The key is simply the number of rails (here 3).
Variants
- Redefence — same principle but with a starting offset (you don’t have to begin on the first rail).
- Scytale — ancient variant that uses a cylinder rather than a sheet.
- Columnar transposition — generalization where column order is permuted by a keyword.
- Double transposition — Rail Fence applied twice with different rail counts.
Strengths and weaknesses
Strengths
- Trivial to apply by hand, even for a child.
- Resists raw frequency analysis — letter distribution stays identical to the plaintext.
Weaknesses
That’s also its tell: if the frequency distribution looks normal but the text reads as gibberish, you’re facing a transposition.
- Brute force: humanly, rail counts range from 2 to 10. Testing each is instant.
- Text structure: ciphertext length divided by the number of rails often hints at the correct key (the zigzag should fill rails evenly).
In CipherChronicle
Rail Fence is the gateway to transpositions, stepping out of the substitution world (Caesar, Atbash). Its grids reward players who notice the “natural” distribution and realize no letter was swapped.
Grid
- 1
Ciphertext
The letters are all there, but in seemingly random order — no substitution.
- 2
Transposition detected
The frequency distribution matches the plaintext — no letter was replaced, only shuffled.
- 3
Hypothesis: 3 rails
The message was written zigzag on 3 lines, then read line by line.
- 4
Reconstructing the zigzag
Redraw the rails and replace each letter on its diagonal position.
- 5
Message revealed
The original order is restored by reading the zigzag left to right.