Skip to main content

Section 2.9 Keyword Columnar Ciphers

We started with some interesting mathematical ways to produce monoalphabetic ciphers. Recall that a monoalphabetic cipher is any permutation of the alphabet. While a completely random permutation of the letters is the most secure it is also the hardest to remember. So what are some ideas for how to determine the monoalphabetic permutation? One idea that was used historically is to use a keyword to define the permutation. For example, MATHEMATICS. Eliminating repeated letters we have MATHEICS. We can now use this to define the cipher as follows:

Table 2.9.1. Keyword Cipher
PT A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
CT M A T H E I C S B D F G J K L N O P Q R U V W X Y Z

Using the keyword and starting at the beginning of the alphabet isn't such a good technique because so many letters at the end of the alphabet get encrypted as themselves. They aren't very common letters, but still this would make it easier to break. So a better option is to start the alphabet at whatever the last letter of the keyword was. So for the same keyword this technique would define the cipher:

Table 2.9.2. Keyword Cipher
PT A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
CT M A T H E I C S U V W X Y Z B D F G J K L N O P Q R

This is better since fewer letters are encrypted as themselves, but there are decent chunks of the alphabet that are just shifts now so that is still a weakness of this system. An even better way to use a keyword is with a keyword columnar transposition to determine the substitution cipher.

Table 2.9.3. Columnar Keyword
M A T H E I C S
B D F G J K L N
O P Q R U V W X
Y Z

We use the columns to determine the substitution:

Table 2.9.4. Keyword Columnar Cipher
PT A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
CT M B O Y A D P Z T F Q H G R E J U I K V C L W S N X
Example 2.9.5.

To encrypt a message we use the table to make the usual assignment between plaintext and ciphertext.

PT: THREE

CT: VZIAA

To decrypt a message we have to remember to reverse the process. So we have to find the letter in the CT row to see what PT letter it corresponds to.

CT: DECI

PT: FOUR

The Sage code below will implement a keyword monoalphabetic cipher.

Sage Computation 2.9.6. Keyword Monoalphabetic Cipher.