Solving Linear Congruences over Cryptography

153 Views Asked by At

I have got some doubt in cryptography mainly related to Linear Congruences.

Question

Suppose that the most common letter and the second most common letter in a long

ciphertext produced by encrypting a plaintext using an Affine Cipher

$f\left(p \right)=\left (ap + b \right)\,\pmod{26} $are $Z$ and $J$ respectively. What are the most likely values of a and b?

Converting Alphabets into Numerals we have $Z=25,J=9$

I was stuck. I looked into solution.In the they have assumed

$f\left(4 \right)=25$ and $f\left(19 \right)=9$

I am not getting how they assuming to take $p=4$ for $f\left(p \right)=25$

and $p=19$ for $f\left(p \right)=9$. I closed the solution and solved the problem by taking

$f\left(4 \right)=25$ and $f\left(19 \right)=9$

My Solution

Affine Cipher is of the form

$f\left(p \right) \equiv \left(ap+b \right)\,\pmod{26}$

$f\left(4 \right)=25$ and $f\left(19 \right)=9$

Equations-:

  1. $\Rightarrow 25 \equiv \left(4a+b \right)\,\pmod{26}$
  2. $\Rightarrow 9 \equiv \left(19a+b \right)\,\pmod{26}$

Subtracting 1 from 2,

$\Rightarrow 10 \equiv \left(15a \right)\,\pmod{26}$

$\Rightarrow 2 \equiv \left(3a \right)\,\pmod{26}$

$\Rightarrow a \equiv 2*3^{-1}\,\pmod{26}$

$\Rightarrow 3^{-1}\Rightarrow$ inverse of $3\,\pmod{26}=9$

$\Rightarrow a \equiv 18\,\pmod{26}=18$

Now, $\Rightarrow 4a+b \equiv 25\,\pmod{26}$

$\Rightarrow 4*18+b \equiv 25\,\pmod{26}$

$\Rightarrow b \equiv 5\,\pmod{26}$

Answer is Correct.But Only thing i am not getting

How $f\left(4 \right)=25$ and $f\left(19 \right)=9$ ???

1

There are 1 best solutions below

0
On

I don't know why you're not getting $25$ and $19$, because that's what I get:

$$f(4) = 18\cdot 4 + 5 = 77 \equiv 25 \pmod{26}.$$

And

$$f(19) = 18\cdot 19 +5 = 347 = 9 \pmod{26}.$$