Transposition Cipher: Rail Fence and Columnar Transposition
What is a Transposition Cipher? (In Simple Words)
In all Substitution Ciphers, we replaced Plain Text letters with different letters.
In a Transposition Cipher (also called a Permutation Cipher), we do NOT replace any letters. Instead, we keep the exact same letters of the Plain Text and simply rearrange (shuffle) their positions according to a specific rule!
💡 Simple Analogy:
Think of an Anagram game in newspapers. If you take the word"LISTEN"and rearrange its letters to form"SILENT", all the original letters (L, I, S, T, E, N) are still there—only their order has changed! That is how a Transposition Cipher works.
1. Rail Fence Cipher (Zig-Zag Cipher)
The Rail Fence Cipher is the simplest form of Transposition Cipher.
How Rail Fence Cipher Works:
- Choose a Depth (Number of Rails/Rows), say d = 2 or d = 3.
- Write the Plain Text message diagonally up and down in a Zig-Zag pattern across the rails (rows).
- Read the letters row by row (from left to right, top row to bottom row) to form the Cipher Text!
📝 Solved Example 1: Rail Fence Cipher (Depth = 2)
Question: Encrypt the Plain Text "MEET ME AFTER THE PARTY" using Rail Fence Cipher with depth = 2.
Step 1: Remove spaces: MEETMEAFTERTHEPARTY
Step 2: Write in a Zig-Zag across 2 rows (rails):
Row 1: M E M A T R H P R Y
\ / \ / \ / \ / \ / \ / \ / \ / \ /
Row 2: E T E F E T E A T
Step 3: Read Row 1 first, followed by Row 2:
- Row 1:
M E M A T R H P R Y - Row 2:
E T E F E T E A T - Final Cipher Text:
M E M A T R H P R Y E T E F E T E A T
2. Row / Columnar Transposition Cipher
The Rail Fence Cipher is very easy to break because there is no complex key. A much stronger technique is the Row / Columnar Transposition Cipher, which uses a Keyword or numerical key to decide the order in which columns are read.
How Columnar Transposition Works:
- Choose a secret Keyword (e.g.,
HACKorZEBRA) and number its letters alphabetically (e.g., inH A C K:Ais 1,Cis 2,His 3,Kis 4 → Key order is3 1 2 4). - Write the Plain Text message row by row into a rectangle under those columns.
- If the last row is incomplete, fill the empty spaces with dummy letters like
XorZ. - Read the letters column by column following the numerical order (
1, 2, 3, 4...) of the key!
📝 Solved Example 2: Columnar Transposition Cipher
Question: Encrypt the Plain Text "ATTACK POSTPONED" using Columnar Transposition with Keyword "HACK".
Step 1: Determine Column Numbers from Keyword "HACK":
- Alphabetical order of
H, A, C, K:A= 1C= 2H= 3K= 4
- So our column numbers are
3 1 2 4.
Step 2: Write the Plain Text row by row into the 4 columns (pad the last empty cell with X):
| H (Col 3) | A (Col 1) | C (Col 2) | K (Col 4) |
|---|---|---|---|
| A | T | T | A |
| C | K | P | O |
| S | T | P | O |
| N | E | D | X |
Step 3: Read the columns vertically in order 1 -> 2 -> 3 -> 4:
-
Column 1 (
A):T K T E -
Column 2 (
C):T P P D -
Column 3 (
H):A C S N -
Column 4 (
K):A O O X -
Final Cipher Text:
T K T E T P P D A C S N A O O X
Double Transposition Cipher:
To make Columnar Transposition even stronger, we can take the Cipher Text produced above, write it into the grid a second time, and read the columns again! This is called Double Transposition and is significantly harder to break.
3. Comparison: Substitution Cipher vs. Transposition Cipher
This is one of the most important 5-mark comparison questions in DAVV Unit 1:
"CAT" ➔ "FDW""CAT" ➔ "ATC"| Feature | Substitution Technique | Transposition Technique |
|---|---|---|
| Core Principle | Replaces Plain Text characters with other characters | Rearranges (shuffles) the positions of Plain Text characters |
| Character Identity | Changes (e.g., A becomes D) |
Remains unchanged (A stays A, just moves to another spot) |
| Character Position | Remains in the original position | Changes to a new position in the sequence |
| Letter Frequency | Original letters disappear, replaced by new ones | Exact same letters and frequencies remain in the Cipher Text |
| Examples | Caesar, Mono-alphabetic, Playfair, Hill, Vigenère | Rail Fence Cipher, Row/Columnar Transposition |
💡 DAVV Exam Preparation Tips
5-Mark / 10-Mark Question: “What is a Transposition Cipher? Explain Rail Fence and Columnar Transposition with suitable examples. Differentiate between Substitution and Transposition techniques.”
- Draw the Zig-Zag diagram for Rail Fence Cipher (
MEET ME AFTER THE PARTY).- Draw the 4-column table for Columnar Transposition using keyword
HACK(3 1 2 4).- Always include the Substitution vs. Transposition table at the end for full marks!