Solving Linear Congruence for Decrypting Affine Cipher

172 Views Asked by At

For Encryption ,Affine Cipher function$\left(bijective \right)$ is given by-:

$f\left(p\right)=\left(a*p+b\right)\,\,mod\,\,26$

Now for Decryption,i need to find the inverse of $f\left(p\right)$

Here i go-:

Let $f\left(p\right) =y=\left(a*p+b\right)\,\,mod\,\,26$

$\Rightarrow y\equiv\,\left(a*p+b\right)\,\,mod\,\,26$

$\Rightarrow y-b\equiv\,a*p\,\,mod\,\,26$

As gcd$\left(a,26\right)=1 \Rightarrow$ Inverse of $a\,\,mod\,\,26$ exists

$\Rightarrow \left(y-b\right)*a^{-1}\equiv\,a^{-1}a*p\,\,mod\,\,26$

$\Rightarrow \left(y-b\right)*a^{-1}\equiv p\,\,mod\,\,26$

I am clear upto now ,infact i derived it by own.But i am unable to move forward.I took help from book but step after it is

$\Rightarrow\,p \equiv\,\left(y-b\right)*a^{-1}\,\,mod\,\,26$

i am not getting this transformation.please help me out.

thanks!