## Mixed Alphabet Cipher

The Mixed Alphabet Cipher is another example of a Monoalphabetic Substitution Cipher, and the way it works is exactly the same as with those already encountered, except in one way. The difference, once again, is how we create the ciphertext alphabet. Unlike all the other ciphers we have seen so far (Atbash, Pigpen, Morse, Shift and Affine), the Mixed Alphabet Cipher does not use a number as a key, but rather a keyword or keyphrase.

**Encryption**With this cipher, rather than performing a mathematical operation on the values of each letter, or just shifting the alphabet, we create a random order for the ciphertext alphabet. In the table below is one such random ciphertext alphabet.

Clearly it is very important to ensure that each letter appears in the ciphertext alphabet once and only once, so that two plaintext letters are not enciphered to the same ciphertext letter.

With the ciphertext alphabet generated, the encryption process is the same as with every other form of Monoalphabetic Substitution Cipher. That is, each occurence of a plaintext letter is replaced with the ciphertext letter that has been assigned to that plaintext letter.

Although it is possible to generate a completely random ordering on the letters of the ciphertext alphabet, as in the table above, it would involve both sender and recipient to remember a random string of 26 letters: not an easy task! For this reason, as with most ciphers, a keyword is often used. The ciphertext alphabet is then generated using this keyword as follows: the keyword is first written, ignoring any repeated letters, and then the remaining letters of the alphabet are written in alphabetical order. For example, if we took the keyword

*monoalphabetic*we would get the alphabets given in the table below.This example demonstrates the ignoring of repeated letters (the second "O" of "MONO" is dropped) and how the rest of the alphabet that has not already appeared follows. It also shows a weakness in the system straight away: in this example "u" encrypts to "U", "v" to "V" and so on to "z". This problem occurs if the keyword does not contain any letters from near the end of the plaintext alphabet. To combat this problem, we can choose a keyword with a letter from near the end of the alphabet.

Although above we have talked of a keyword for generating the ciphertext alphabet, we could also use a key phrase or even sentence, removing any characters (such as spaces or punctuation) that do not appear in the alphabet being used.

**Decryption**As with the other ciphers of this type, the decryption process is similar to the encryotion process. The first step is to generate the ciphertext alphabet in the same way as with the encryption process. We then do the opposite, finding the ciphertext letter in the ciphertext alphabet, and replacing this with the corresponding plaintext letter.

**Discussion**The first point to make here is that every Monoalphabetic Substitution Cipher using letters is a special case of the Mixed Alphabet Cipher. The Atbash, Shift and Affine Ciphers are all cases of this much larger class of cipher. Each is a way of reordering the ciphertext alphabet by a given rule, rather than using a keyword.

The next point for discussion is the number of possible keys for the Mixed Alphabet Cipher, using a standard alphabet of 26 letters. Some simple maths helps us calculate this.

First we realise that there are 26 possible choices for the first letter in the ciphertext alphabet. Now, for the second letter, we can use any letter APART from the letter we have already selected for the first position, so there are 25 choices for the second position. For the third position we can choose any letter, apart from either the letter in the first position or the second position, and hence there are 24 choices here. Thus, for the first 3 places, there are 26 x 25 x 24 possible choices.

Continuing in this way, we quickly find that there are 26! (26 factorial, where factorial means multiplying all the whole numbers less than 26) possible keys for this cipher. This is a deceptively large number for its appearance. In fact:

First we realise that there are 26 possible choices for the first letter in the ciphertext alphabet. Now, for the second letter, we can use any letter APART from the letter we have already selected for the first position, so there are 25 choices for the second position. For the third position we can choose any letter, apart from either the letter in the first position or the second position, and hence there are 24 choices here. Thus, for the first 3 places, there are 26 x 25 x 24 possible choices.

Continuing in this way, we quickly find that there are 26! (26 factorial, where factorial means multiplying all the whole numbers less than 26) possible keys for this cipher. This is a deceptively large number for its appearance. In fact:

**26! = 403,291,461,126,605,635,584,000,000**

This is an absurdly large number. If every person on earth (say 8 billion) was to try one key a second, then it would still take 1,598,536,043 (that's one and a half billion) years to try every possible combination.

Clearly it is not feasible to attack such a cipher with a brute force attack, and because of this, one might suppose that the Mixed Alphabet Cipher is a very secure cipher. However, as we shall see is the case throughout history, whenever a cipher is created, there are people trying to break it, and there is a method to break any Monoalphabetic Substitution Cipher without too much difficulty.