Rju Tsq Sz Koxjuhm: The Multiplication Cipher

Cipher cracking is food for the brain. Often when you give kids a cipher puzzle, and you’ll struggle to get them to stop cracking them. In…

Rju Tsq Sz Koxjuhm: The Multiplication Cipher

Cipher cracking is food for the brain. Often when you give kids a cipher puzzle, and you’ll struggle to get them to stop cracking them. In groups they will talk, and share ideas, and then the work together to solve them. There’s something magical about taking something that is secret and discovering it. So let’s do a little bit of cipher creation.

Let’s what Caesar wants to send a secret message to Cleoptra, and doesn’t want Mark Antony to read the message. For this Caeser could use a shifted alphabet cipher, and where he moves the letters by three places to the right:

In this case a cipher of KHOOR is deciphered as “hello”. Unfortunately this is not a strong cipher as there are only 25 valid ciphers, and it would be thus easy for Mark Antony to crack it. An improved method is then to scramble the alphabet:

In this case the message that Caesar sends is “LQNZDOO”, and which is “inkwell”. The good thing with this cipher is that there are 26! different combinations, so it would take Mark Antony a long time — with brute force — to find the right match. So Caesar things up a single way of sending Cleopatra the secret code to generate the cipher alphabet. He then sends the cipher and adds a message:

rsiqmxukoadzhounp
To you, count your digits on one side — Caesar

Cleopatra reads it, and generates


Plain: abcdefghijklmnopqrstuvwxyz
Cipher:afkpuzejotydinsxchmrwbglqv

She reads the message of “tomydearfiend”. But how did she decode it? Well, she read the messages, and determined that there are five digits on one hand, and used the value of 5 to decipher the message. She then used the Multiplication Cipher.

In this case we take each letter (P) and multiple it by a value (a). For example “c” becomes 2, and multiplied by 2 gives 4, which gives “e”. As the value may be greater than 25, we take a modulo 26 operation to make sure we end up with a letter, such as [here]:

C = (a * P) mod 26

In order to create unique cipher characters, we must use a multiplier which is co-prime (the values do not share any factors when dividing — see Try GCD of 5) in relation to the size of the alphabet (26), so you should use either 1, 3, 5, 7, 9, 11, 15, 17, 19, 21, 23 or 25.

For example if we use “abcdefghijklmnopqrstuvwxyz” and a multiplier of 3, gives “adgjmpsvybehknqtwzcfilorux”

You can try the sample button which uses a multiplication of 3, and a message of “knowledgeispower” gives enqohmjsmyctqomz.

  • Try “abcdefghijklmnopqrstuvwxyz” with a key of “3”. Try!, which should give: adgjmpsvybehknqtwzcfilorux
  • Try “abcdefghijklmnopqrstuvwxyz” with a key of “11”. Try!, which should give: alwhsdozkvgrcnyjufqbmxitep
  • Try “abcdefghijklmnopqrstuvwxyz” with a key of “5”. Try!, which should give: afkpuzejotydinsxchmrwbglqv Check answer (a=5)
  • Try “more” with a key of “19”. Try!, which should give: ugly

If we use a value which is not co-prime, such as 2, we will not get unique characters for the mapping:

  • Try “abcdefghijklmnopqrstuvwxyz” with a key of “2” (Try GCD of 2). Try!, which should give: acegikmoqsuwyacegikmoqsuwy, where we can see there are repeated cipher text characters (such as “m” and “z” mapping to “y”).

Unfortunately this type of cipher is easily broken with frequency analysis. In this following we see that an “o” or a “u” is likely to be mapped to an “e” (as it is the most popular letter in the English alphabet:

If you want to try and crack a scrambled alphabet cipher in less than five minutes, try here:

Can you decipher: “rju tsq sz koxjuhm”?