Search for a tool
Two-square Cipher

Tool to decript/encrypt the Two-square cipher automatically, from 2 grids/keywords and a principle similar to Playfair.

Results

Two-square Cipher -

Tag(s) : Polygrammic Cipher, GRID_CIPHER

Share
Share
dCode and more

dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!
A suggestion ? a feedback ? a bug ? an idea ? Write to dCode!


Please, check our dCode Discord community for help requests!
NB: for encrypted messages, test our automatic cipher identifier!


Feedback and suggestions are welcome so that dCode offers the best 'Two-square Cipher' tool for free! Thank you!

Two-square Cipher

Two-Square Decoder

 




Loading...
(if this message do not disappear, try to refresh this page)

Loading...
(if this message do not disappear, try to refresh this page)



Two-Square Encoder

 


Loading...
(if this message do not disappear, try to refresh this page)

Loading...
(if this message do not disappear, try to refresh this page)


Answers to Questions (FAQ)

What is the Two-Square cipher? (Definition)

Two-square cipher is a polygrammic cipher that uses a playfair-like process to encrypt (it is also called double playfair), except that it uses two keys or 5x5 square-grids

How to encrypt using Two-Square cipher?

Two-Square cipher (or double square cipher) encryption uses two squared grid/checkboard placed side to side (default horizontal variant), or one above the other (vertical variant), sometimes generated with a key word (deranged alphabet)

Example: Crypt DCODE with two grids (horizontal) generated with the words KEY and WORD respectively

\12345
1KEYAB
2CDFGH
3ILMNO
4PQRST
5UVWXZ
\12345
1WORDA
2BCEFG
3HIKLM
4NPQST
5UVXYZ

The first step consists in splitting the plain text into bigrams (couples of two letters). If the last bigram is incomplete (odd message length), add a random letter from the grid to complete the bigram.

Example: DC, OD, EZ (letter Z added)

Second step, for each bigram, find the first letter in the first grid and the second letter in the second grid and apply the following rules:

— if the letters are on the same line (or columns in vertical version), reverse them

— else, replace them by the letters one the same rows but on the opposite corner of an imaginary rectangle, with the two first letters as opposite vertices. In practice, locate the two original letters and find the two other letters that create an imaginary rectangle. Encrypted letters are written beginning with the one on the same row (horizontal variant) as the first letter of the plain bigram (use same column with vertical variant)

Example: D (grid 1) and C (grid 2) are on the same row, switch them: CD
O (grid 1, row 3, column 5) and D (grid 2, row 1, column 4) are not on the same row, opposite corners are L (grid 2, row 3, column 4) and B (grid 1, row 1, column 5)
E (grid 1, row 1, column 2) and Z (grid 2, row 5, column 5) are not on the same row, opposite corners are A (grid 2, row 1, column 5) and V (grid 1, row 5, column 2)
Final encrypted text is then CDLBAV

How to decrypt a Two-Square cipher?

Two-Square cipher Decryption requires two grids/checkboards generated with two keys. The cipher text is split into bigrams (couples of 2 letters).

Example: The cipher text is CDLBAV (split in CD, LB, AV) and the grids are in horizontal position

\12345
1KEYAB
2CDFGH
3ILMNO
4PQRST
5UVWXZ
\12345
1WORDA
2BCEFG
3HIKLM
4NPQST
5UVXYZ

For each bigram, locate the first letter in grid 2 and the second letter in grid 1.

If the two letters are on the same row (or column in vertical version), swap them.

Else, find the 2 original letters by locating the two letters that complete the imaginary rectangle (see encryption). As for the encryption process, write the letters by starting with the same row (or column depending on the variant used) as the first letter of the encrypted bigram.

Example: C (grid 2) and D (grid 1) are on the same row, switch them: DC
L (grid 2, row 3, column 4) and B (grid 1, row 1, column 5) are not on the same row, opposite corners are O (grid 1, row 3, column 5) and D (grid 2, row 1, column 4)
A (grid 2, row 1, column 5) and V (grid 1, row 5, column 2) are not on the same row, opposite corners are E (grid 1, row 1, column 2) and Z (grid 2, row 5, column 5)
The original plain text is DCODEZ.

How to recognize Two-Square ciphertext?

The ciphered message needs 2 keys, and generally has a maximum of 25 distinct characters.

The presence of 2 grids or 2 squares is a clue.

All references to pairs of words or famous duos (used as keys for generating the grids) are clues.

How to decipher Two-Square without the two squares?

Two-Square can be cracked by a frequency analysis of bigrams if the text is long enough.

dCode offers a brute force grid attack.

What are the variants of the Two-Square cipher?

Excepting variations due to creating a deranged alphabet out of the keys, it is possible to modify:

— the position of the grids, for example, by setting them vertically rather than horizontally. In this case, encryption and decryption processes should take into account bigram letters on the same column rather than on the same row

— the order of the letters of the bigrams (by default, the first letter comes from grid 2 then grid 1)

— the order of the grid (swap grid 1 and 2)

When was Two-Square invented?

Probably near of the invention of the PlayFair algorithm (towards 1850)

Source code

dCode retains ownership of the "Two-square Cipher" source code. Except explicit open source licence (indicated Creative Commons / free), the "Two-square Cipher" algorithm, the applet or snippet (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, breaker, translator), or the "Two-square Cipher" functions (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) and all data download, script, or API access for "Two-square Cipher" are not public, same for offline use on PC, mobile, tablet, iPhone or Android app!
Reminder : dCode is free to use.

Cite dCode

The copy-paste of the page "Two-square Cipher" or any of its results, is allowed (even for commercial purposes) as long as you credit dCode!
Exporting results as a .csv or .txt file is free by clicking on the export icon
Cite as source (bibliography):
Two-square Cipher on dCode.fr [online website], retrieved on 2024-12-21, https://www.dcode.fr/two-square-cipher

Need Help ?

Please, check our dCode Discord community for help requests!
NB: for encrypted messages, test our automatic cipher identifier!

Questions / Comments

Feedback and suggestions are welcome so that dCode offers the best 'Two-square Cipher' tool for free! Thank you!


https://www.dcode.fr/two-square-cipher
© 2024 dCode — The ultimate 'toolkit' to solve every games / riddles / geocaching / CTF.
 
Feedback