Foursquare Tutorial

Introduction

The Foursquare cipher is a digraphic substitution cipher similar to the Playfair. Unlike the Playfair cipher, which is based on a single Polybius square, Foursquare uses 4 Polybius squares arranged into a single large square. The four squares are labeled from 1 to 4 starting in the upper left and proceeding clockwise. Squares 1 and 3 contain unkeyed plaintext alphabets placed in the normal order. Squares 2 and 4 are keyed ciphertext alphabets and may be placed in the squares in any of the usual ways. Continue reading Foursquare Tutorial

Playfair Tutorial

Introduction

The Playfair cipher is a digraphic substitution cipher based on a 5 x 5 Polybius square formed with a keyword (N.B., I/J are considered equivalent). The plain text is broken up into two letter combinations (digraphs). Double letters are not permitted and must be separated by inserting a null (Usually an ‘X’). If a single letter is left at the end of the plain text, a null is also inserted there to complete the digraph. Continue reading Playfair Tutorial

Polybius Square

As we begin to set our sights upon Cm Cipher Exchange (CE) constructions, it will aid us to become familiar with the makeup and working of a keying device known as the Polybius Square that is used to key many of the CE ciphers. Ciphers using the Polybius Square are substitution type ciphers in which each letter of the plaintext is represented by a pair of digits.

Polybius was a Greek historian (203-120 B.C.) who first proposed a method of using a unique two digit number for each letter of the alphabet. A five by five square with numbered columns and rows is used to “store” the alphabet.

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

Note that the letters “I” and “J” are written in the same cell to divide the letters evenly. To encode, we simply substitute the numbers in the rows and columns for the letter we wish to use. Always put the row number before the column number. For example, the number for the letter “S” will be 43. The numbers for the word “encode” will be:

15  33  13  34  14  15

Are you thinking that this is far too simple and easily decipherable? It is until we complicate the scenario with the introduction of a keyword. Look what happens to our ciphertext numbers for “encode” when the keyword “SQUARE” is introduced to our Polybius Square.

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

Ciphertext for “encode” becomes:

21  42  23  43  24  21

The diabolical constructor can magnify the complexity of the keyword square by changing the order of the letter pattern. The letters can be written in vertically, in reverse order, in a spiral or  diagonal formation. They need not even begin in the upper left hand corner of the square. What is a poor innocent solver to do? As with Aristocrats, Patristocrats and Xenocrypt ciphers, cribs, frequency counts and knowledge of the general properties of letters, ACA and You Handbook, page 14, become very valuable in observing just which direction the keyword square letters are aligned. We will start the solving process with a straight forward example, accompanied by a crib.

PS-1 Polybius Hybrid. Gram cracker.(solver)  LIONEL

15    12 14 51 42 31    11 12 13 14    45 14 35 52 24 13   

53 32 14   23 24 22 13 12 43 11 45   11 12 13 14            

31 13 15 41 45   33 45    15    31 13 15 41  

22 13 15 22 34 24 13.

Placement of the crib in the only place it will fit (the sixth word is hyphenated) leads to this plaintext and Polybius Square start.

15    12 14 51 42 31    11 12 13 14
         O                    r  o

45 14 35 52 24 13    53 32 14
s  o  l  v  e  r           o

23 24 22 13 12 43 11 45
   e     r           s

11 12 13 14    31 13 15 41 45
      r  o        r        s

33 45    15    31 13 15 41
   s              r

22 13 15 22 34 24 13.
   r           e  r.

PS-1 Use the title, short words and high frequency letters (senorita) to help you complete the plaintext and Polybius Square with its key word.

   1  2  3  4  5
1  .  .  R  O  .
2  .  .  .  E  .
3  .  .  .  .  L
4  .  .  .  .  S
5  .  V  .  .  .

We began our discussion of a Polybius Square with a construction we called a Polybius hybrid. We referred to it as a hybrid because we put the construction together in a manner to demonstrate its principles. As you use the Polybius Square for future Cipher Exchange constructions, each cipher type will have its own way of using the square as a key to its encryption. We will discuss the subtle variations in the uses of the Polybius Square as we study each cipher type. At present, we will continue to refer to the usage of horizontal and vertical numerals to identify each block of the square.

We presented a simplistic horizontal arrangement of letters in our square to allow us to more easily digest the instruction principles. We will increase the degree of difficulty just a bit in to illustrate how the diabolical constructor may alter a key square to increase the security of the message. Always keep in mind that the purpose of the Polybius Square is for it to be the keying device between the writer and the reader. Let’s look for the clues that indicate to us that a key square is something different than a simple horizontal letter flow.

Location of Low Frequency Letters

When crib placement letters result in the locating of low frequency letters in a place other than the last row of the 5 x 5 square, we have a clue that something may be amiss. Perhaps, VWXYZ is part of the keyword and appears in the first or second row of the square, but low letter frequency locations as below tell us even more about the order of the square.

  1 2 3 4 5        1 2 3 4 5
1 . . . . V      1 V . . . .
2 . . . . W      2 W . . . .
3 . . . . X      3 X . . . .
4 . . . . Y      4 Y . . . .
5 . . . . Z      5 Z . . . .
VERTICAL ORDER   REVERSE VERTICAL

1 2 3 4 5        1 2 3 4 5
1 . . . . .      1 Z X W . .
2 . . . . .      2 Y V . . .
3 . . . . W      3 . . . . .
4 . . . V Y      4 . . . . .
5 . . . X Z      5 . . . . .
DIAGONAL ORDER   REVERSE DIAGONAL

1 2 3 4 5
1 Z Y X W V
2 . . . . .
3 . . . . .
4 . . . . .
5 . . . . .    REVERSE HORIZONTAL

Keep in mind that the letters “I” and “J” are always written in the same cell to allow the complete alphabet to fit in the 25 cell square.

Keyword Recovery

With so many possible alphabet order variations, you may wonder how a key word can ever be recovered, but proper crib placement leads to both plaintext and five by five key square recovery. See how the crib placement below leads to both plaintext and keyword square recovery.

PS-2 Polybius Square. Old timer’s lament. (youth)            LIONEL

51 35 32 51 41 41    51 14 51 31 13 45
                                     y

23 41    25 12 41 44 51 42    21 14
                   t

44 11 51    45 21 54 44 11.
 t h        y  o   u  t  h

PS-2 Determine the square key and alphabet order.

   1 2 3 4 5
1  H . . . .
2  O . . . .
3  . . . . .
4  . . . T Y
5  . . . U . 

PS-3. Poly High. South Sea Adventure. (going)     LIONEL         

24 42    34 12 24 43 34    14 12    52 22 11 15  

14 15 22 14    42 22 43    45 24 34 15 14    12 13 14

12 25   42 54   15 22 14 45   12 43 32   11 33 43 32

15 24 42    12 43    15 24 11    52 22 54.

PS-4.  Holly Poly Xmas.  (Christmas)      LIONEL

53 42 25 23    42    53 21 31 31 41    12 21 31 31 41 52 53 34 12 32 15 24 42 32    12 15 32   

15 53 23  51 23 32 15    15 12 24 23    21 33    15 53 23   41 23 42 54   12   13 21 34 15 

14 34 21 35   12 33   15 53 23 54 23 31 31   51 23   32 34 21 35  51 22 15   53 42 25 23   42 

52 22 11   21 33  52 53 23 23 54   51 22 54 31   12 25 23 32