# Monoalphabetic Ciphers

Created | Updated Jan 28, 2002

### What is a Monoalphabetic Cipher?

Monoalphabetic Substitution Ciphers, to give them their full name, are the simplest type of ciphers known. Substitution means that each character in the plaintext message is replaced by another character in order to produce the ciphertext message. The ciphertext character can be anything at all: a squiggle or a diagram, a sequence of dots or, most commonly, a letter of the alphabet.

These ciphers are called monoalphabetic because they literally use only a single alphabet, so if the plaintext letter 'E' is substituted with the ciphertext letter 'R' then every single instance of 'E' in the plaintext will equate to an 'R' in the ciphertext.

Morse Code is a MSC type cipher, why it was called a code is unknown.

### The Julius Caesar Cipher

The Julius Caesar Cipher is the most commonly known MSC. It uses two complete alphabets with one shifted a certain number of places relative to the other. The classical example shifts the alphabets by three places in total. This means that the plaintext letter 'A' is encrypted as the ciphertext letter 'D'. This continues throughout the alphabet so plaintext 'B' becomes ciphertext 'E' and the alphabet 'wraps' so that plaintext 'Z' becomes ciphertext 'C'.

#### The Julius Caesar Cipher using key 'D'

Plaintext : ABCDEFGHIJKLMNOPQRSTUVWXYZ

Ciphertext: DEFGHIJKLMNOPQRSTUVWXYZABC

As with all monoalphabetic ciphers the Julius Caesar Cipher is very weak against cryptanalysis, but moreover it has a gigantic weakness that not all monoalphabetic ciphers suffer. It has a total of only 25 useful **keys**, there are only 25 positions the alphabet can be shifted before it reaches alignment again and has no value as a cipher. This means that if it were known that a Julius Caesar Cipher were being used there would be no need for cryptanalysis at all, merely trying out each of the 25 keys in turn would take only a few minutes.

One of the variants of the Julius Caesar Cipher is usually known as ROT13. This has the key set to 'N', or +13. It has the advantage that the same routine can be used to encrypt and decrypt and is occasionally used to encrypt text so that it is not immediately obvious what the message is. UNIX systems have a command that can be used to translate ROT13 quickly and easily so it has achieved some popularity on the internet where it can be used to avoid intelligent software scanners that might look for specific words in a message. Because it is a Julius Caesar variant it offers no useful security.

#### The Statistics of the Julius Caesar Cipher

**Alphabets:**1**Blocklength:**1**Keyspace:**25

### A More Secure MSC

A single-character monoalphabetic cipher is always going to be extremely vulnerable to cryptanalysis, this is because only one alphabet is used and a blocklength of 1 is inherent. However it is possible to resolve the tiny keyspace issue. If the alphabet was written down and a truly random order of letters was placed opposite it then there would be a gigantic number of possible keys. This is because you could select any one of the twenty-six letters of the alphabet to be the ciphertext equivalent of the plaintext 'A', then pick any one of the remaining twenty-five to be the equivalent of 'B' and so on. In fact there are more than 4x10^{26} possible combinations, a huge keyspace.

#### An Example Key

Plaintext : ABCDEFGHIJKLMNOPQRSTUVWXYZ

Ciphertext: GLDCNUXAQOWPBSZKYREIFJMHVT

#### Statistics

**Alphabets:**1**Blocklength:**1**Keyspace:**4x10^{26}

### The Playfair Cipher

The Playfair Cipher was designed by the polymath Wheatstone, inventor of the 'Wheatstone Bridge'. It is often described as polyalphabetic but actually this is incorrect. Where it differs from other monoalphabetic ciphers is in the blocklength. The Playfair cipher uses a blocklength of two characters.

To use the Playfair cipher a grid must be drawn up, containing twenty-five squares in a five by five square. Using some agreed method the grid is filled with the letters of the alphabet, with 'I' and 'J' occupying the same square. The plaintext message is written down and then split into pairs of letters, there must be an even number of letters in the message, so if necessary a null is added to the end. The pairs must each consist of different letters, so if a single pair contains two identical letters a null is inserted between them.

To encrypt, the following rules are followed:

- If the two letters of the pair are in the same row of the grid then each is replaced by the letter to its right in the grid.
- If the two letters of the pair are in the same column of the grid then each is replaced by the letter below it in the grid.
- If the two letters of the pair are in neither the same row of the grid nor the same column of the grid then they could be seen to form two corners of a rectangle. Each letter is replaced by the letter in the same row as it but at the other corner of the rectangle.

The procedure is reversed for decryption.

The Playfair Cipher can encrypt a given letter to more than one cipher text letter in a message, but this doesn't make it polyalphabetic, each *pair* of letters is always encrypted to the same *pair* of ciphertext letters, so it is not the use of multiple alphabets but the use of a blocklength of two that makes this cipher more secure. Since the letters can be arranged in the grid in any order there is a very large number of possible combinations and therefore a huge keyspace. The fact that 'I' and 'J' are tied together, however makes the keyspace twenty-six times smaller than in the example above.

#### Playfair Example

In this example the Playfair grid has been built using the password 'CALIBRATE'.

CALIB

RTEDF

GHKMN

OPQSU

VWXYZ

To encrypt the message 'SEND FOOD' first split it into letter pairs:

SE ND FO OD

Then each pair is encrypted by the Playfair rules to give:

QD MF RU SR

So the message 'QDMFRUSR' is transmitted. Note the fact that the letter 'R' appears twice in the ciphertext but in one case it fills the position occupied by the plaintext letter 'F', on the other occasion it replaces the plaintext letter 'D'.

#### The Statistics of the Playfair Cipher

**Alphabets:**1**Blocklength:**2**Keyspace:**1.55x10^{25}