Solving Linear Congruences for Affine Cipher.

738 Views Asked by At

Question

Find all pairs of integers keys $\left(a,b \right)$ for affine ciphers for which the encryption function $$c\equiv\left( ap + b \right) \pmod{26} $$ is the same as the corresponding decryption function.

My Approach

$$c\equiv\left( ap + b \right)\pmod {26}$$

Decryption function $$p\equiv\left( c- b \right) \times a^{-1}\pmod{26}$$

equalizing both equation, we have

$$\left( ap + b \right)\pmod{26}\equiv\left( c- b \right) \times a^{-1}\pmod{26}$$

No idea what to do next. Please help me out ! thanks

1

There are 1 best solutions below

7
On

Note that I am writing congruences as identities, for simplicity of notation.

Hint 1

You want to find $a, b$ such that modulo $26$ the identity $$p = a (a p + b) + b = a^{2} p + a b + b,$$ that is $$(a^{2} - 1) p + (a + 1) b = 0,$$ holds for all $p$.

Hint 2

Setting $p = 0$ we obtain $(a + 1) b = 0$.

Hint 3

Setting $p = 1$ we obtain $a^{2} = 1$ which yields $a = \pm 1$.

Hint 4

If $a = -1$ we are fine for all $b$.

Hint 5

If $a = 1$, then $2 b = 0$, so $b = 0, 13$.