- Monoalphabetic
- Caesar Cipher
- Atbash Cipher
- Keyword Cipher
- Pigpen / Masonic Cipher
- Polybius Square
- Polyalphabetic
- Vigenère Cipher
- Beaufort Cipher
- Autokey Cipher
- Running Key Cipher
- Polygraphic
- Playfair Cipher
- Bifid Cipher
- Trifid Cipher
- Four-square cipher
- Transposition
- Rail Fence
- Route Cipher
- Columnar Transposition
- Miscellaneous
- Book Cipher
- Beale Cipher
- Morse Code
- Tap Code
- One-time Pad
- Scytale
- Semaphore
- ASCII Code
- Steganography
- Techniques
- Frequency Analysis
- Books

### Codes and Ciphers
Codes and Ciphers
- Monoalphabetic
- Caesar Cipher
- Atbash Cipher
- Keyword Cipher
- Pigpen / Masonic Cipher
- Polybius Square
- Polyalphabetic
- Vigenère Cipher
- Beaufort Cipher
- Autokey Cipher
- Running Key Cipher
- Polygraphic
- Playfair Cipher
- Bifid Cipher
- Trifid Cipher
- Four-square cipher
- Transposition
- Rail Fence
- Route Cipher
- Columnar Transposition
- Miscellaneous
- Book Cipher
- Beale Cipher
- Morse Code
- Tap Code
- One-time Pad
- Scytale
- Semaphore
- ASCII Code
- Steganography
- Techniques
- Frequency Analysis
- Books

- Monoalphabetic
- Caesar Cipher
- Atbash Cipher
- Keyword Cipher
- Pigpen / Masonic Cipher
- Polybius Square
- Polyalphabetic
- Vigenère Cipher
- Beaufort Cipher
- Autokey Cipher
- Running Key Cipher
- Polygraphic
- Playfair Cipher
- Bifid Cipher
- Trifid Cipher
- Four-square cipher
- Transposition
- Rail Fence
- Route Cipher
- Columnar Transposition
- Miscellaneous
- Book Cipher
- Beale Cipher
- Morse Code
- Tap Code
- One-time Pad
- Scytale
- Semaphore
- ASCII Code
- Steganography
- Techniques
- Frequency Analysis
- Books

# Four-square Cipher

The four-square cipher encrypts pairs of letters (digraphs) and is thus less susceptible to frequency analysis attacks.

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 four-square cipher uses four 5 by 5 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. The four-square algorithm allows for two separate keys, one for each of the two ciphertext matrices. In the example to the right, "EXAMPLE" and "KEYWORD" have been used as keywords.

To encrypt a message you would first split the message into digraphs. "This is a secret message" would become:

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

Once that was complete, you would take the first pair of letters and find the first letter in the upper left square and the second letter in the lower right square. In this example we are enciphering TH, so we locate T and H in the grid below (see blue characters). Now, we find the intersections of the rows and columns of the plain text letters. In this example, they have been highlighted in red (R and B). These new letters are the enciphered digraph (RB).

You continue enciphering digraphs in this way until you reach the end of the message. To continue our example, "This is a secret message" would be enciphered as:

Source: Wikipedia

## Follow Braingle!