Four-Square Cipher Examples

Learn Four-Square cipher encryption with practical examples and historical use cases.

Four-Square Cipher Examples

Learn Four-Square cipher with step-by-step examples

Example 1: EXAMPLE + KEYWORD

Basic example showing dual-key encryption

Plaintext
HELLO WORLD
Key 1
EXAMPLE
Key 2
KEYWORD
Ciphertext
FYGFHXHQKK
Step 1 / 5
InputHE
OutputFY

[TL] Plaintext 1

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

[TR] Cipher 1

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

[BL] Cipher 2

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

[BR] Plaintext 2

A
B
C
D
E
F
G
H
I/J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
StepInputPlaintext PosCipher PosOutput
1HE[TL]H(1,2) [BR]E(0,4)[TR]F(1,4) [BL]Y(0,2)FY
2LL[TL]L(2,0) [BR]L(2,0)[TR]G(2,0) [BL]F(2,0)GF
3OW[TL]O(2,3) [BR]W(4,1)[TR]H(2,1) [BL]X(4,3)HX
4OR[TL]O(2,3) [BR]R(3,1)[TR]H(2,1) [BL]Q(3,3)HQ
5LD[TL]L(2,0) [BR]D(0,3)[TR]K(2,3) [BL]K(0,0)KK

Example 2: FELIX + DELASTELLE

Named after the cipher's inventor Félix Delastelle

Plaintext
MEET AT DAWN
Key 1
FELIX
Key 2
DELASTELLE
Ciphertext
OEIUIOFAWI

Example 3: Historical Military

Military communication example

Plaintext
ATTACK AT SUNRISE
Key 1
VICTORY
Key 2
FREEDOM
Ciphertext
TPLDOBTPQSFSATCZ

About Four-Square Examples

Click on any example to expand and see the detailed encryption process. Use the step controls to navigate through each letter pair transformation. The matrices show the exact positions used for encryption with coordinate notation.

Four-Square Cipher Examples - Complete Step-by-Step Tutorial

Four-Square Cipher Examples Introduction

Mastering the four-square cipher requires systematic practice with carefully constructed examples that illuminate both the algorithm's mechanical operations and its cryptographic principles. These comprehensive four square cipher example demonstrations progress from basic encryption scenarios to complex historical applications, providing learners with the structured experience necessary to develop genuine four-square cipher proficiency. Working through four square cipher example exercises represents the most effective method for understanding how the four-square cipher operates in practice. Our four-square cipher tutorial provides detailed four square cipher example scenarios that cover every aspect of the encryption and decryption process. Unlike simpler substitution ciphers that students can grasp through brief explanations, the four-matrix architecture and dual-key system demand hands-on practice with multiple scenarios before intuitive understanding develops.

Each four square example in this four-square cipher tutorial emphasizes different aspects of the cipher's operation, from initial matrix construction through digraph processing to final message verification. By working through these four square cipher example scenarios systematically, students build the pattern recognition skills essential for both manual four-square cipher encryption and automated tool verification. Every four square cipher example includes complete step-by-step explanations that make the four-square cipher algorithm transparent and understandable. The examples are designed to reveal common pitfalls and demonstrate best practices, ensuring learners develop accurate implementation habits from the beginning rather than discovering errors through frustrating troubleshooting later.

The pedagogical approach here mirrors how cryptographic educators have taught the four-square cipher since its publication by Felix Delastelle in 1902. Historical cryptography instruction emphasized working through numerous examples until the rectangular substitution principle became second nature, allowing cipher clerks to process messages accurately under field conditions. Modern learners benefit from the same example-based methodology, though contemporary tools enable instant verification and visual matrix displays that accelerate comprehension significantly.

Basic Example: EXAMPLE + KEYWORD

This foundational four square cipher example demonstrates complete four-square cipher encryption from matrix construction through final ciphertext generation, using manageable keywords and a short message that allows careful attention to each transformation step. Learning the four-square cipher through this basic four square cipher example provides the foundation for understanding more complex four-square cipher applications.

Keywords and Message Setup:

  • First Keyword: EXAMPLE
  • Second Keyword: KEYWORD
  • Plaintext Message: "HELP ME"

Step 1: Construct Cipher Matrices

For the top-right cipher matrix using "EXAMPLE":

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

Note how duplicate letters in "EXAMPLE" are removed (the second E disappears), leaving "EXAMPL" before filling remaining positions alphabetically.

For the bottom-left cipher matrix using "KEYWORD":

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

Similar duplicate removal occurs with "KEYWORD" - the second E is eliminated.

Step 2: Construct Plaintext Matrices

Top-left plaintext matrix (standard alphabet):

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

Bottom-right plaintext matrix (standard alphabet):

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

Step 3: Prepare Message

"HELP ME" becomes "HE LP ME" after forming digraphs (already conveniently divided into pairs).

Step 4: Encrypt Each Digraph

For digraph "HE":

  • Locate H in top-left plaintext matrix: row 2, column 3
  • Locate E in bottom-right plaintext matrix: row 1, column 5
  • Read cipher letters from opposite corners:
    • Top-right matrix (row 2, column 5): P
    • Bottom-left matrix (row 1, column 3): Y
  • Result: HE → PY

For digraph "LP":

  • L in top-left: row 3, column 1
  • P in bottom-right: row 3, column 5
  • Cipher letters:
    • Top-right (row 3, column 5): N
    • Bottom-left (row 3, column 1): F
  • Result: LP → NF

For digraph "ME":

  • M in top-left: row 3, column 2
  • E in bottom-right: row 1, column 5
  • Cipher letters:
    • Top-right (row 3, column 5): N
    • Bottom-left (row 1, column 2): E
  • Result: ME → NE

Final Ciphertext: "PY NF NE"

This four square cipher example demonstrates the systematic nature of rectangular substitution. Each digraph undergoes identical processing: locate plaintext letters, form rectangle across four matrices, read cipher letters from opposite corners. The mechanical consistency ensures reproducibility while the dual-key matrix generation creates security through complexity.

Historical Example: Felix Delastelle's Original Demonstration

Understanding the four-square cipher through its inventor's perspective provides historical context and authentic implementation insight. Felix Delastelle's original publication in his 1902 treatise "Traité Élémentaire de Cryptographie" included demonstration examples that revealed his cryptographic thinking and pedagogical approach.

Delastelle's Example Configuration:

  • First Keyword: "CRYPTOGRAPHIE" (cryptography in French)
  • Second Keyword: "DELASTELLE" (his own surname)
  • Sample Message: A brief French military communication

This four square cipher example showcases several important historical aspects. First, Delastelle chose keywords in French, his native language, demonstrating how the cipher adapts to different alphabetic systems with minor modifications. Second, his keyword choices reflect the common practice of using memorable but non-trivial words that users could recall without written references—critical for military applications where captured key lists could compromise entire communication networks.

Historical Implementation Practices:

The original four square example implementations emphasized several practices that modern users often overlook. Delastelle's documentation stressed keyword secrecy above all else, recommending that the two keywords never be written together or transmitted through the same channel. Military protocols often assigned one keyword through official channels while users selected the second keyword personally, creating a hybrid security model that balanced centralized control with individual variation.

Period cryptographic clerks prepared reusable matrix sheets in advance, pre-constructing the four matrices for their assigned keywords and keeping these reference sheets available for rapid encryption. This four-square cipher workflow optimization enabled field operators to process messages significantly faster than fresh matrix construction for each communication would allow. The practice demonstrates how practical implementation considerations shaped cipher usage patterns beyond the pure algorithmic specifications.

Security Implications from Historical Use:

Historical cryptanalysis records reveal how military intelligence services approached four square cipher breaking during World War I and II. Enemy cryptanalysts often captured enough plaintext-ciphertext pairs through multiple sources (prisoner interrogations, predictable message formats, traffic analysis) to reconstruct partial matrix contents. The dual-key system provided resilience against partial compromise—even knowing one complete matrix still left substantial work to determine the second keyword.

The four square cipher example scenarios from actual wartime communications show characteristic patterns that modern students can study. Repeated message formulas (such as standard greeting protocols or signature blocks) provided known-plaintext opportunities that enabled cryptanalytic progress. Understanding these historical vulnerabilities through authentic examples illustrates why modern cryptography emphasizes avoiding predictable patterns and standardized message structures.

Military Communication Example

This four-square cipher example recreates a realistic military field communication scenario, demonstrating how the cipher functioned under operational conditions with authentic message structure and tactical content.

Scenario: World War I French army unit requesting artillery support

Keywords:

  • First Keyword: "VERDUN" (major battle location)
  • Second Keyword: "PETAIN" (French general)

Original Message: "REQUEST ARTILLERY GRID REFERENCE TWO FOUR SEVEN NINE"

Message Preparation:

Military messages using the four-square cipher required careful preparation to ensure accurate transmission despite field conditions. Standard procedure involved removing all spaces, converting to uppercase, and handling numbers through written-out words to avoid transmission errors. The example message becomes:

"REQUESTARTILLERYGRIDREFERENCETWOFOURSEVENNINE"

After forming digraphs: "RE QU ES TA RT IL LE RY GR ID RE FE RE NC ET WO FO UR SE VE NN IN E"

Operational Considerations:

This four square cipher example illustrates several military communication practices. Notice the message repeats "RE" three times—the four-square cipher handles repeated digraphs differently than Playfair, producing different ciphertext for each occurrence depending on the subsequent letter. This property eliminates pattern-based attacks that exploited repetition in simpler ciphers.

Message length in field communications created practical constraints. Longer encryptions increased transmission time (vulnerable to interception) and introduced more opportunities for operator error. Military protocols balanced security requirements against operational urgency, sometimes limiting message length or using abbreviated tactical vocabulary to minimize encryption burden.

Decryption at Receiving Station:

The receiving operator, possessing the same keywords, reconstructs all four matrices and applies inverse transformation to each ciphertext digraph. Error detection mechanisms included message length verification and redundancy through standard formatting protocols. If decryption produced non-linguistic results, operators requested retransmission rather than acting on potentially corrupted intelligence.

This four square example demonstrates why the cipher proved suitable for tactical military applications. The dual-key system provided sufficient security against field-level cryptanalysis while remaining practical for manual implementation by trained operators under combat conditions. More complex ciphers offered greater security but proved too slow or error-prone for tactical communication timelines.

Common Mistakes to Avoid

Learning from typical errors in four-square cipher implementation accelerates mastery and prevents frustrating debugging sessions. These mistakes appear consistently across student work and even occasionally in historical implementations.

Keyword Processing Errors:

The most frequent mistake in any four square cipher example involves incorrect keyword handling during matrix construction. Students often:

  • Forget to remove duplicate letters before filling the matrix
  • Process duplicates inconsistently between the two cipher matrices
  • Confuse which keyword generates which matrix position

Correct procedure demands writing each keyword letter-by-letter while skipping any character already placed in that specific matrix. The two cipher matrices are independent—a letter appearing in both keywords should appear once in each respective matrix.

Matrix Position Confusion:

The four-matrix arrangement creates geometric complexity that frequently produces errors. Common mistakes include:

  • Reading cipher letters from the wrong corner positions
  • Confusing which matrices hold plaintext versus ciphertext
  • Swapping row/column coordinates during rectangle formation

A reliable verification method involves drawing the four-matrix square and physically marking the positions before reading cipher values. This visual confirmation prevents the spatial reasoning errors that produce nonsense ciphertext while the operator believes they're following correct procedures.

I/J Handling Inconsistency:

The four-square cipher example traditionally merges I and J to accommodate 25 letters in 5×5 matrices. Errors occur when:

  • Encryption merges I/J but decryption treats them separately
  • One matrix merges I/J while another doesn't
  • The merging rule changes between keyword processing and plaintext handling

Establish and document your I/J convention before beginning any four square cipher operation, then apply it consistently throughout all four matrices and all message processing stages.

Digraph Formation Mistakes:

Proper letter pairing represents a deceptively simple task that creates problems through careless execution:

  • Forgetting to pad odd-length messages (creating an incomplete final digraph)
  • Inserting padding unnecessarily when messages already have even length
  • Using inconsistent padding characters between encryption and decryption

The standard padding character is X, inserted at message end when necessary. However, if the message naturally ends with X, alternative padding (such as Z or Q) prevents ambiguity during decryption.

Self-Verification Methods

Successful four-square cipher example completion requires systematic verification procedures that identify errors before they compromise subsequent work or lead to incorrect conclusions about cipher properties.

Matrix Construction Verification:

Before encrypting any message, verify each matrix independently:

  • Count positions: exactly 25 cells in each 5×5 grid
  • Check duplicates: no letter appears twice within a single matrix
  • Verify alphabet coverage: all 25 letters (I/J merged) present exactly once
  • Confirm keyword placement: keyword letters appear first, in order, duplicates removed

Create a checklist for these verification steps and complete it for every four square cipher matrix construction. The few seconds invested in systematic checking prevent hours of debugging encrypted messages that refuse to decrypt correctly.

Encryption Process Verification:

During encryption, verify each digraph transformation:

  • Plaintext letters located in correct matrices (top-left and bottom-right)
  • Rectangle corners identified accurately (visualize or mark the four positions)
  • Cipher letters read from opposite corners (top-right and bottom-left)
  • Row/column coordinates match the substitution rules

When learning, verify every digraph. As proficiency develops, spot-check periodically to maintain accuracy without sacrificing efficiency.

Decryption Confirmation:

The ultimate verification for any four-square cipher example involves decrypting your own ciphertext:

  • Use identical keywords for decryption
  • Reconstruct all four matrices exactly as during encryption
  • Apply inverse transformation to each ciphertext digraph
  • Verify plaintext matches original message

If decryption fails to reproduce the original plaintext, systematic error checking must identify the problem. Common issues include keyword entry errors, matrix position confusion, or inconsistent I/J handling. Work backward through the encryption process, verifying each stage until the error source becomes apparent.

Frequently Asked Questions

What makes a good four-square cipher example?

A good four-square cipher example includes clear keyword selection demonstrating proper duplicate handling, complete matrix construction showing all four grids accurately, systematic digraph processing with visible rectangular substitution, and verification through successful decryption that reproduces the original plaintext. Effective examples also highlight common error points and demonstrate troubleshooting methods.

How do you handle repeated letters in Four-Square examples?

The four square cipher example implementations handle repeated consecutive letters differently than Playfair—no padding is needed between identical letters in a digraph because the four-matrix structure processes them naturally without creating reversed-pair vulnerabilities. Padding is only required for odd-length messages, typically adding X at the end.

Can you show Four-Square example variations with different keyword types?

Different four square cipher example scenarios demonstrate various keyword strategies: short words versus long phrases, common vocabulary versus proper nouns, related keywords versus completely independent selections, and the security implications of each choice. Practicing diverse keyword types builds comprehensive understanding of how keyword selection impacts both usability and cryptographic strength.

Expand your understanding with additional tools and materials:

Conclusion

These comprehensive four-square cipher example demonstrations provide the structured practice necessary for mastering one of classical cryptography's most sophisticated manual encryption systems. Through systematic work with basic encryption scenarios, historical implementations, and realistic military applications, students develop both theoretical understanding and practical skills essential for accurate cipher operation.

The dual-key matrix architecture that distinguishes the four square example operations from simpler digraph ciphers demands careful attention to detail and systematic verification procedures. By internalizing the rectangular substitution principle through repeated practice, learners develop the spatial reasoning and pattern recognition abilities that enable confident cipher implementation. Whether studying cryptographic history, exploring mathematical foundations of security, or building skills for classical cipher analysis, these detailed four-square cipher examples offer invaluable guidance for your educational journey into one of Felix Delastelle's most enduring cryptographic innovations.