Affine cipher easy question

817 Views Asked by At

I have this lecture slide. I am hoping someone can take me through line by line of how it works, because I cannot understand the a to the power of -1 part.

So far I have

Key(3,5).
EncLetter((3,5), 7) = 3 * 7 + 5 mod 26 = 0
DecLetter((3,5),0) = ???? * (0-5) mod 26 = ???

I need to calculate an inverse or something, but I have no idea.

From the comments it appears that I am very wrong. If someone could please provide a step by step instruction with how to calculate this I would be eternally grateful.

Slide

1

There are 1 best solutions below

0
On BEST ANSWER

So your encryption function for a letter $m$ is $3m + 5 \pmod{26}$, and indeed $E(7) = 26 \equiv 0$.

To go back we have to subtract $5$ first and we get $-5 \equiv 21 \pmod{26}$ and then we have to "divide by $3$", which just means, by definition really, to multiply by the inverse of $3$ modulo $26$ and this inverse of $3$ is $9$ as $$3 \times 9 = 27 \equiv 1 \pmod{26}$$

And $21 \times 9 = 189 \equiv 7 \pmod{26}$ as $189 = 7\times 26+7$, or alternatively $-5 \times 9 = -45 \equiv -45 + 52 = 7 \pmod{26}$.

In any case, we get back the $7$, as we should.

So decryption in a formula:

$$D(c) = 9(c-5) \pmod{26}$$

or using that $-45 \equiv 7$, as we saw,

$$D(c) = 9c + 7 \pmod{26}$$

and note that it is of the same form as the encryption formula.