The Tri-Square Cipher is a polygraphic substitution cipher that operates on digraphs (pairs of letters) using three separate keyed 5×5 squares. Each square contains a unique permutation of the alphabet, often constructed from a keyword, with the letter J typically combined with I to fit the 25-cell square. By using three squares simultaneously, the cipher increases complexity and resists frequency analysis more effectively than simpler digraphic systems like the Playfair Cipher or Digrafid Cipher.
The encryption process involves mapping each plaintext digraph to positions in the first and third squares, and then using the second square as an intermediary to produce ciphertext letters. If the plaintext length is odd, a padding character (commonly X) is added to complete the final digraph.
Tri-Square Cipher: Encoding
To encrypt using the Tri-Square Cipher, the plaintext is normalized, padded if necessary, split into digraphs, and processed through the three keyed squares:
Plaintext: HELLOTRISQUARE
1st Key: KEYONE
2nd Key: KEYTWO
3rd Key: KEYTHREE
Padding: X
Step 1: Normalize and pad plaintext
HELLOTRISQUARE → HELLOTRISQUARE
Step 2: Split into digraphs
HE LL OT RI SQ UA RE
Step 3: Map each digraph through the Tri-Square algorithm
Ciphertext:
GEMLTTQIQQVROYEach pair of letters from the plaintext is transformed using the positions in the three squares. The first and third squares determine the row and column, while the second square provides the substitution, producing a highly diffused ciphertext.
Tri-Square Cipher: Decoding
Decoding reverses the process using the same three keyed squares. Each ciphertext digraph is mapped back through the intermediary square to retrieve the original plaintext. The padding character, if present, is ignored or removed at the end:
Ciphertext: GEMLTTQIQQVROY
1st Key: KEYONE
2nd Key: KEYTWO
3rd Key: KEYTHREE
Padding: X
Step 1: Reverse Tri-Square mapping on each digraph
Step 2: Reassemble plaintext
Plaintext:
HELLOTRISQUARETri-Square Cipher: Notes
The Tri-Square Cipher enhances classical digraphic encryption by introducing a third square, which significantly increases keyspace and reduces predictability. Key characteristics include:
- Type: Polygraphic substitution cipher (digraph-based)
- Key: three distinct keywords generating three 5×5 squares
- Unit: digraphs (pairs of letters)
- Padding: typically X for incomplete final digraphs
- Operation: first and third squares provide coordinates; second square acts as substitution intermediary
- Strengths: strong against frequency analysis and simple digraphic attacks
- Weaknesses: still vulnerable if keys are known or predictable
The Tri-Square Cipher is an elegant expansion of the Digrafid Cipher, offering a clear demonstration of polygraphic complexity while remaining accessible for educational purposes.