Two-square Cipher - Algorithm

Algorithm

Encryption using two-square is basically the same as the system used in four-square, except that the plaintext and ciphertext digraphs use the same matrices.

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"

- - - - - L - - D - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - L - - P - - - - - -

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 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

Read more about this topic:  Two-square Cipher