Exhibit 42 of 137 Late 19th Century · ~1902 Weak

Two-Square Cipher

Delastelle's simpler sibling of Four-square — two keyed 5×5 squares

InventorFélix Delastelle (France)
Year~1902
Key TypeTwo keywords (two keyed squares)
Broken ByDigram frequency · same-row leak
Modern LessonBeware of identity transformations as edge cases

Why This Matters

A pared-down version of the Four-square: only two keyed squares, side by side. Slightly easier to use by hand but with a glaring weakness — when a digram's two letters happen to lie in the same row of their respective squares, the cipher leaves them unchanged. Roughly 20% of digrams pass through unencrypted.

📜Historical Context

Published alongside the Four-square in Delastelle's 1902 treatise. The "horizontal" variant places the squares side by side; a "vertical" variant stacks them. Both share the same-row leak. Used recreationally rather than militarily.

⚙️How It Works

Arrange two keyed 5×5 squares horizontally. For each digram, look up the first letter in the left square and the second in the right square. Read the ciphertext from the opposite corners of the rectangle they form.

If the two letters share a row → leave them unchanged.
Otherwise:
  cipher[0] = left[ row(L), col(R) ]
  cipher[1] = right[ row(R), col(L) ]

💀How It Was Broken
Same-Row Leakage
Complexity: Easy

Roughly one in five digrams passes through the cipher unchanged. An attacker can identify these by noticing common English digrams (TH, HE, IN, ER) appearing as themselves in the ciphertext. From there, the rows are partially recovered.

Digram Frequency Analysis
Complexity: Moderate

As with Four-square, the cipher is a fixed digram-to-digram substitution. Digram frequency tables and simulated annealing recover both keys with a few hundred characters of ciphertext.

🔬What It Teaches Modern Cryptography
Concept from Two-Square CipherModern Evolution
Identity transformations as weaknessModern designs eliminate fixed points (e.g., AES S-box has no fixed point)
Two-key fractionationTwin-key constructions appear in HMAC and double-encryption
Quick Facts
Exhibit42 of 49
EraLate 19th Century · ~1902
SecurityWeak
InventorFélix Delastelle (France)
Year~1902
Key TypeTwo keywords (two keyed squares)
Broken ByDigram frequency · same-row leak
Modern LessonBeware of identity transformations as edge cases
← Previous Four-Square Cipher