Four-square Cipher - Algorithm

Algorithm

To encrypt a message, one would follow these steps:

  • Split the payload message into digraphs. (HELLO WORLD becomes HE LL OW OR LD)
  • Find the first letter in the digraph in the upper-left plaintext matrix.
a b c d e E X A M P f g h i j L B C D F k l m n o G H I J K p r s t u N O R S T v w x y z U V W Y Z K E Y W O a b c d e R D A B C f g h i j F G H I J k l m n o L M N P S p r s t u T U V X Z v w x y z
  • Find the second letter in the digraph in the lower-right plaintext matrix.
a b c d e E X A M P f g h i j L B C D F k l m n o G H I J K p r s t u N O R S T v w x y z U V W Y Z K E Y W O a b c d e R D A B C f g h i j F G H I J k l m n o L M N P S p r s t u T U V X Z v w x y z
  • The first letter of the encrypted digraph is in the same row as the first plaintext letter and the same column as the second plaintext letter. It is therefore in the upper-right ciphertext matrix.
a b c d e E X A M P f g h i j L B C D F k l m n o G H I J K p r s t u N O R S T v w x y z U V W Y Z K E Y W O a b c d e R D A B C f g h i j F G H I J k l m n o L M N P S p r s t u T U V X Z v w x y z
  • The second letter of the encrypted digraph is in the same row as the second plaintext letter and the same column as the first plaintext letter. It is therefore in the lower-left ciphertext matrix.
a b c d e E X A M P f g h i j L B C D F k l m n o G H I J K p r s t u N O R S T v w x y z U V W Y Z K E Y W O a b c d e R D A B C f g h i j F G H I J k l m n o L M N P S p r s t u T U V X Z v w x y z

Using the four-square example given above, we can encrypt the following plaintext:

Plaintext: he lp me ob iw an ke no bi Ciphertext: FY GM KY HO BX MF KK KI MD

Here is the four-square written out again but blanking all of the values that aren't used for encrypting the first digraph "he" into "FY"

- - - - - - - - - - - - h - - - - - - F - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Y - - - - - - e - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

As can be seen clearly, the method of encryption simply involves finding the other two corners of a rectangle defined by the two letters in the plaintext digraph. The encrypted digraph is simply the letters at the other two corners, with the upper-right letter coming first.

Decryption works the same way, but in reverse. The ciphertext digraph is split with the first character going into the upper-right matrix and the second character going into the lower-left matrix. The other corners of the rectangle are then located. These represent the plaintext digraph with the upper-left matrix component coming first.

Read more about this topic:  Four-square Cipher