Four-Square Cipher

Keysquare 1
Keysquare 2

Four-Square Cipher is a manual symmetric encryption technique. It was invented by the French cryptographer Felix Delastelle.

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 ciphers which operate on single characters. The use of digraphs makes the four-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. [Wikipedia]


The Four-Square Cipher uses four 5 by 5 (5x5) matrices arranged in a square. Each of the 5 by 5 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). In general, the upper-left and lower-right matrices are the "plaintext squares" and each contain a standard alphabet. The upper-right and lower-left squares are the "ciphertext squares" and contain a mixed alphabetic sequence.

To generate the ciphertext squares, 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 5 by 5 table constitute the cipher key. The four-square algorithm allows for two separate keys, one for each of the two ciphertext matrices.

As an example, here are the four-square matrices for the keywords "example" and "keyword." The plaintext matrices are in lowercase and the ciphertext matrices are in caps to make this example visually more simple:

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

How it works?

  1. Break up the plaintext into bigrams i.e. ATTACK AT DAWN --> AT TA CK AT DA WN. An 'X' (or some other character) may have to be appended to ensure the plaintext is an even length.

  2. Using the four 'squares', two plain alphabet squares and two cipher alphabet squares, locate the bigram to encrypt in the plain alphabet squares. The example below enciphers the bigram 'AT'. The first letter is located from the top left square, the second letter is located in the bottom right square.

    a b c d e   Z G P T F
    f g h i k   O I H M U
    l m n o p   W D R C N
    q r s t u   Y K E Q A
    v w x y z   X V S B L
     
    M F N B D   a b c d e
    C R H S A   f g h i k
    X Y O G V   l m n o p
    I T U E W   q r s t u
    L Q Z K P   v w x y z
    
  3. Locate the characters in the ciphertext at the corners of the rectangle that the letters 'AT' make:

    a b c d e   Z G P T F
    f g h i k   O I H M U
    l m n o p   W D R C N
    q r s t u   Y K E Q A
    v w x y z   X V S B L
     
    M F N B D   a b c d e
    C R H S A   f g h i k
    X Y O G V   l m n o p
    I T U E W   q r s t u
    L Q Z K P   v w x y z
  4. Using the above keys, the bigram 'AT' is encrypted to 'TI'. The text 'attack at dawn', with the keys 'zgptfoihmuwdrcnykeqaxvsbl' and 'mfnbdcrhsaxyogvituewlqzkp', becomes:

ATTACKATDAWN
TIYBFHTIZBSY
The Vigenère Cipher is a method of encrypting alphabetic text where each letter of the plaintext is encoded with a different Caesar Cipher, whose increment is determined by the corresponding letter of another text, the key.

Vigenère Cipher

The Vigenère Cipher is a method of encrypting alphabetic text where each letter of the plaintext is encoded with a different Caesar Cipher, whose increment is determined by the corresponding letter of another text, the key.
Atbash Cipher is a substitution cipher with a specific key where the letters of the alphabet are reversed. I.e. all 'A's are replaced with 'Z's, all 'B's are replaced with 'Y's, and so on. It was originally used for the Hebrew alphabet, but can be used for any alphabet.

Atbash Cipher

Atbash Cipher is a substitution cipher with a specific key where the letters of the alphabet are reversed. I.e. all 'A's are replaced with 'Z's, all 'B's are replaced with 'Y's, and so on. It was originally used for the Hebrew alphabet, but can be used for any alphabet.
Beaufort Cipher, is a polyalphabetic substitution cipher that is similar to the Vigenère cipher, except that it enciphers characters in a slightly different manner.

Beaufort Cipher

Beaufort Cipher, is a polyalphabetic substitution cipher that is similar to the Vigenère cipher, except that it enciphers characters in a slightly different manner.
Bifid Cipher is a cipher which combines the Polybius square with transposition, and uses fractionation to achieve diffusion.

Bifid Cipher

Bifid Cipher is a cipher which combines the Polybius square with transposition, and uses fractionation to achieve diffusion.