CacheHackCacheHack

Four Square Cipher

Encode and decode using the Four Square cipher. A digraphic cipher using four 5x5 squares.

Four Squares

Standard (Plain 1)

A
B
C
D
E
F
G
H
I
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z

Keyword 1 (Cipher 1)

E
X
A
M
P
L
B
C
D
F
G
H
I
K
N
O
Q
R
S
T
U
V
W
Y
Z

Keyword 2 (Cipher 2)

K
E
Y
W
O
R
D
A
B
C
F
G
H
I
L
M
N
P
Q
S
T
U
V
X
Z

Standard (Plain 2)

A
B
C
D
E
F
G
H
I
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
J is treated as I

How Four Square Works

  1. Split plaintext into pairs (digraphs)
  2. Find first letter in top-left (standard) square
  3. Find second letter in bottom-right (standard) square
  4. Cipher letters are at rectangle corners in keyed squares

What is the Four Square Cipher?

The Four Square cipher is a manual symmetric encryption technique that encrypts pairs of letters (digraphs) using four 5×5 matrices arranged in a square. Two matrices use the standard alphabet, and two use keyed alphabets.

How It Works

Setup

Arrange four 5×5 squares in a 2×2 grid:

  • Top-left: Standard alphabet
  • Top-right: Keyed alphabet (keyword 1)
  • Bottom-left: Keyed alphabet (keyword 2)
  • Bottom-right: Standard alphabet

Encryption

  1. Take a pair of plaintext letters
  2. Find first letter in top-left square (note position)
  3. Find second letter in bottom-right square (note position)
  4. First cipher letter: top-right square at (row1, col2)
  5. Second cipher letter: bottom-left square at (row2, col1)

Four Square in Geocaching

This cipher appears in puzzles because:

  • Two keywords: Both can be puzzle clues
  • Visual element: The four squares make interesting puzzle images
  • Moderate security: Harder than simple substitution
  • Historical: Classic cryptographic method

Advantages

  • No double letter issues: Unlike Playfair
  • More secure: Two independent keys
  • No padding issues: Digraphs encrypt smoothly

Breaking the Cipher

Without the keywords:

  • Frequency analysis: Analyze digraph frequencies
  • Known plaintext: Helps determine the keyed squares
  • Dictionary attack: Try common keyword combinations
  • Hill climbing: Optimize both squares simultaneously