Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Two-square cipher
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Encryption technique}} The '''Two-square cipher''', also called '''double Playfair''', is a manual [[symmetric key algorithm|symmetric]] [[encryption]] technique.<ref Name="I20">{{cite web |url=https://drive.google.com/drive/folders/0B_oIJbGCCNYeMGUxNzk0NWQtNzNhZi00YWVjLWI1NmItMzc2YWZiZGNjNjQ5 |title=TICOM I-20 Interrogation of SonderFuehrer Dr Fricke of OKW/CHI |publisher=NSA |page=2|date=28 June 1945 |website=sites.google.com |access-date=29 August 2016}}</ref> It was developed to ease the cumbersome nature of the large encryption/decryption matrix used in the [[four-square cipher]] while still being slightly stronger than the single-square [[Playfair cipher]]. The technique encrypts pairs of letters (''digraphs''), and thus falls into a category of ciphers known as [[polygraphic substitution]] ciphers. This adds significant strength to the encryption when compared with [[monographic substitution cipher]]s, which operate on single characters. The use of digraphs makes the two-square technique less susceptible to [[frequency analysis]] attacks, as the analysis must be done on 676 possible digraphs rather than just 26 for monographic substitution. The frequency analysis of digraphs is possible, but considerably more difficult, and it generally requires a much larger ciphertext in order to be useful. == History == [[Félix Delastelle]] described the cipher in his 1901 book ''Traité élémentaire de cryptographie'' under the name ''damiers bigrammatiques réduits'' (reduced digraphic checkerboard), with both horizontal and vertical types.<ref Name="Traite">{{cite book|url=https://archive.org/details/8VSUP3207b/page/n9|title=Traité élémentaire de cryptographie|year=1902|pages=80–81|access-date=7 December 2019}}</ref> The ''two-alphabet checkerboard'' was described by [[William F. Friedman]] in his book ''Advanced Military Cryptography'' (1931) and in the later [[Military Cryptanalysis]] and [[Military Cryptanalytics]] series.<ref Name="AMC">{{cite book|url=https://www.nsa.gov/Portals/70/documents/news-features/declassified-documents/friedman-documents/publications/FOLDER_239/41748809078800.pdf|title=Advanced Military Cryptography|author=Friedman, William F.|publisher=Chief Signal Officer|year=1931|access-date=7 December 2019}}</ref> Friedman's co-author on ''[[Military Cryptanalytics]]'', [[Lambros D. Callimahos]] described the cipher in [[Collier's Encyclopedia]] in the ''Cryptography'' article.<ref name="CE">{{cite news|url=https://archive.org/details/colliersencyclop07shor/page/524|year=1965|title=Collier's Encyclopedia|author=Callimahos, Lambros D.|access-date=7 December 2019}}</ref> The encyclopedia description was then adapted into an article in ''The Cryptogram'' of the [[American Cryptogram Association]] in 1972.<ref Name="ACA">{{cite journal|title=The Twosquare Cipher|author=Machiavelli (Mccready, Warren Thomas)|journal=The Cryptogram|issue=Nov-Dec 1972|pages=152–153|year=1972}}</ref> After this, the cipher became a regular cipher type in ACA puzzles.<ref Name="cipher">{{cite web|url=http://www.cryptogram.org/resource-area/cipher-types/|title=Cipher Types|author=American Cryptogram Association|access-date=7 December 2019}}</ref> In 1987, Noel Currer‐Briggs described the [[double Playfair]] cipher used by Germans in World War II.<ref name="NCB">{{cite journal|doi=10.1080/02684528708431890|author=Currer-Briggs, Noel|title=Some of ultra's poor relations in Algeria, Tunisia, Sicily and Italy|journal=Intelligence and National Security|volume=2|number=2|pages=274–290|year = 1987}}</ref> In this case, ''double Playfair'' refers to a method using two [[Polybius square]]s plus seriation. Even variants of Double Playfair that encipher each pair of letters twice are considered weaker than the [[double transposition]] cipher.<ref> WGBH Educational Foundation. [https://www.pbs.org/wgbh/nova/decoding/doubplayfair.html "The Double Playfair Cipher"]. 2000. </ref> {{Quote |text= ''... by the middle of 1915, the Germans had completely broken down British Playfair. At the same time they recognised its flexibility and simplicity, and decided they could make it more secure and adapt it for their own use. Instead of using one 5 x 5 square and dividing the clear text into bigrams in the way I have just described, they used two squares and wrote the whole message out in key-lengths on specially prepared squared message forms arranged in double lines of a given length.'' |author= Noel Currer-Briggs<ref name="noel"> Noel Currer-Briggs. "Army Ultra's Poor Relations" a section in Francis Harry Hinsley, Alan Stripp. [https://books.google.com/books?id=j1MC2d2LPAcC "Codebreakers: The Inside Story of Bletchley Park"]. 2001. p. 211 </ref> }} Other slight variants, also incorporating seriation, are described in Schick (1987)<ref name="Schick">{{cite journal|doi=10.1080/0161-118791861767|author=Schick, Joseph S.|title=With the 849th SIS, 1942-45|journal=Cryptologia|year=1987|volume=11|issue=1|pages=29–39}}</ref> and David (1996).<ref name="David">{{cite journal|doi=10.1080/0161-118791861767|author=David, Charles|title=A World War II German Army Field Cipher and how we broke it|journal=Cryptologia|volume=20|issue=1|year=1996|pages=55–76}}</ref> The two-square cipher is not described in some other 20th century popular cryptography books e.g. by [[Helen Fouché Gaines]] (1939) or William Maxwell Bowers (1959), although both describe the [[Playfair cipher]] and [[four-square cipher]].<ref name="Bowers1959">{{cite book|author=Bowers, William Maxwell|title=Digraphic substitution: the Playfair cipher, the four square cipher|url=https://books.google.com/books?id=vEs8AQAAIAAJ|year=1959|publisher=American Cryptogram Association|page=25}}</ref> == Using two-square == The two-square cipher uses two 5x5 matrices and comes in two varieties, horizontal and vertical. The horizontal two-square has the two matrices side by side. The vertical two-square has one below the other. Each of the 5x5 matrices contains the letters of the alphabet (usually omitting "Q" or putting both "I" and "J" in the same location to reduce the alphabet to fit). The alphabets in both squares are generally [[mixed alphabet]]s, each based on some keyword or phrase. To generate the 5x5 matrices, one would first fill in the spaces in the matrix with the letters of a keyword or phrase (dropping any duplicate letters), then fill the remaining spaces with the rest of the letters of the alphabet in order (again omitting "Q" to reduce the alphabet to fit). The key can be written in the top rows of the table, from left to right, or in some other pattern, such as a spiral beginning in the upper-left-hand corner and ending in the center. The keyword together with the conventions for filling in the 5x5 table constitute the cipher key. The two-square algorithm allows for two separate keys, one for each matrix. As an example, here are the vertical two-square matrices for the keywords "example" and "keyword": E X A M P L B C D F G H I J K N O R S T U V W Y Z K E Y W O R D A B C F G H I J L M N P S T U V X Z == Algorithm == Encryption using two-square is basically the same as the system used in [[Four-square cipher|four-square]], except that the plaintext and ciphertext digraphs use the same matrixes. To encrypt a message, one would Follow these steps: * Split the payload message into digraphs. (''help me obi wan kenobi'' becomes ''he lp me ob iw an ke no bi'') * For a vertical two-square, the first character of both plaintext and ciphertext digraphs uses the top matrix, while the second character uses the bottom. * For a horizontal two-square, the first character of both digraphs uses the left matrix, while the second character uses the right. * Find the first letter in the digraph in the upper/left text matrix. E X A M P '''''L''''' B C D F G H I J K N O R S T U V W Y Z K E Y W O R D A B C F G H I J L M N P S T U V X Z * Find the second letter in the digraph in the lower/right plaintext matrix. E X A M P '''''L''''' B C D F G H I J K N O R S T U V W Y Z K E Y W O R D A B C F G H I J L M N '''''P''''' S T U V X Z * A rectangle is defined by the two plaintext characters and the opposite corners define the ciphertext digraph. E X A M P '''L''' B C '''''D''''' F G H I J K N O R S T U V W Y Z K E Y W O R D A B C F G H I J '''''L''''' M N '''P''' S T U V X Z Using the vertical two-square example given above, we can encrypt the following plaintext: Plaintext: he lp me ob iw an ke no bi Ciphertext: HE DL XW SD JY AN HO TK DG Here is the same two-square written out again but blanking all of the values that aren't used for encrypting the digraph "LP" into "DL" - - - - - <span style="color:red;">L</span> - - <span style="color:blue;">D</span> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <span style="color:blue;">L</span> - - <span style="color:red;">P</span> - - - - - - The rectangle rule used to encrypt and decrypt can be seen clearly in this diagram. The method for decrypting is identical to the method for encryption. Just like Playfair (and unlike four-square), there are special circumstances when the two letters in a digraph are in the same column for vertical two-square or in the same row for horizontal two-square. For vertical two-square, a plaintext digraph that ends up with both characters in the same column gives the same digraph in the ciphertext. For horizontal two-square, a plaintext digraph with both characters in the same row gives (by convention) that digraph with the characters reversed in the ciphertext. In cryptography this is referred to as a transparency. (The horizontal version is sometimes called a reverse transparency.) Notice in the above example how the digraphs "HE" and "AN" mapped to themselves. A weakness of two-square is that about 20% of digraphs will be transparencies. E X A M P L B C D F G <span style="color:purple;">'''H'''</span> I J K N O R S T U V W Y Z K <span style="color:purple;">'''E'''</span> Y W O R D A B C F G H I J L M N P S T U V X Z == Two-square cryptanalysis == Like most pre-modern era ciphers, the two-square cipher can be easily cracked if there is enough text. Obtaining the key is relatively straightforward if both plaintext and ciphertext are known. When only the ciphertext is known, brute force [[cryptanalysis]] of the cipher involves searching through the key space for matches between the frequency of occurrence of digraphs (pairs of letters) and the known frequency of occurrence of digraphs in the assumed language of the original message. Cryptanalysis of two-square almost always revolves around the transparency weakness. Depending on whether vertical or horizontal two-square was used, either the ciphertext or the reverse of the ciphertext should show a significant number of plaintext fragments. In a large enough ciphertext sample, there are likely to be several transparent digraphs in a row, revealing possible word fragments. From these word fragments the analyst can generate candidate plaintext strings and work backwards to the keyword. A good tutorial on reconstructing the key for a two-square cipher can be found in chapter 7, "Solution to Polygraphic Substitution Systems," of [https://archive.org/details/Fm3440.2BasicCryptAnalysis Field Manual 34-40-2], produced by the United States Army. ==References== {{reflist}} == See also == * [[Topics in cryptography]] * [[Playfair cipher]] {{Clear}} {{Cryptography navbox | classical}} [[Category:Classical ciphers]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Cite book
(
edit
)
Template:Cite journal
(
edit
)
Template:Cite news
(
edit
)
Template:Cite web
(
edit
)
Template:Clear
(
edit
)
Template:Cryptography navbox
(
edit
)
Template:Quote
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)