# Readme

Decipher a simple code based on the rule C=7P+17 (mod 26) where C is the code for the letter P from the alphabet. Rearrange the formula and use the inverse to decipher automatically.

Mathematical methods of encryption are of vital importance in ensuring the security of electronic communication and financial transactions.

This is an example of a simple cipher which can be cracked quite easily to serve as an introduction to some of the ideas.

The message given has been enciphered using the formula $C=7P+17 \pmod { 26}$ where $P$ represents the letters of the alphabet taking values $a=0,\ b=1,\ {\rm to}\ z=25$ and $C$ represents the cipher value of the corresponding $P$.

It is easy to decipher the message by using the given formula to find the cipher numbers for each letter. But can you rearrange the formula to give $P$ in terms of $C$ using the multiplicative inverse of 7 (mod 26) and the additive inverse of 17 (mod 26) and hence decipher the message?

20 14 19 23 11 13 20 21 4 5 11 23 18 6 19 14 19 4 13 21 24 16 19 20 14 21 4 7 17 24 11 1 20 20 14 19 15 11 6 16 12 21 13 20 14 17 20 21 20 21 13 5 11 23 18 6 19 14 19 4 13 21 24 16 19

You might like to write a computer program to encipher or decipher messages using this system.

In modulus arithmetic the only numbers involved are the whole numbers 0 to $m-1$ where $m$ is the modulus (or if you prefer it 1 to $m$). The multiplicative inverse of 7 (mod 26) is the number (equivalent to 1/7) that 7 is multiplied by to get the answer 1. The additive inverse of 17 is the number you add to 17 to get the answer 0 (mod 26).

Here is another brilliant solution from Andrei from School No. 205, Bucharest, Romania

I have to find the secret message

20 14 19 23 11 13 20 21 4 5 11 23 18 6 19 14 19 4 13 21 24 16 19 20 14 21 4 7 17 24 11 1 20 20 14 19 15 11 6 16 12 21 13 20 14 17 20 21 20 21 13 5 11 23 18 6 19 14 19 4 13 21 24 16 19

which has been coded by using the equation: $$C=7P + 17 \pmod {26}$$ where $C$ is the cipher value of the corresponding $P$ and $P$ represents the letters of the alphabet taking $a=0,\ b=1,\ c=2,\ ...$ to $z=25$.

Solving this equation for $P$ gives $$P={1\over 7}C - {17\over 7} \pmod{26}.$$ Using the reverse of the multiplication table mod 26, I found: $$P = 15C - 21 = 15 C + 5 \pmod{26} \quad (1)$$ Performing the operations in equation (1) using the properties of arithmetic operations mod 26, I found the following sequence of numbers 19, 7, 4, 12, 14, 18, 19, 8, 13, 2, 14, 12, 15, 17, 4, 7, 4, 13, 18, 8, 1, 11, 4, 19, 7, 8, 13, 6, 26, 1, 14, 20, 19,19, 7, 4, 22, 14, 17, 11, 3, 8, 18, 19, 7, 26, 19, 26, 18, 2, 14, 12, 15, 17, 4, 7, 4, 13, 18, 8, 1, 11, 4. These, transformed into words, produced the following message:

"The most incomprehensible thing about the world is that it is comprehensible".

This example is merely an introduction to the subject to introduce the idea of devising formulae with corresponding deciphering formulae to encipher and decipher text automatically.