I am trying to cryptanalyse a cipher–text encrypted by Affine cipher.

The encryption formula is: $c = f(x) = (ax+b)\bmod m$, where $a$ and $b$ are unknown constants; $x$ is a plain-text symbol, and $c$ the corresponding cipher-text symbol, both in range $[0\dots m-1]$; $m=26$ is known.

This is what I got so far:

$x=4\implies c=17$

$x=19\implies c=10$

That means that letter 4 has been encrypted into 17 (numbers are according to alphabetical order of letters in English language). Same applies to the line below. Now goes the following calculations:



$a=3$ [because $15\cdot3=45$ and $45\equiv19\pmod{26}$]


I don’t get the logic which leads to obtaining $b$ value. Any help, please?


1 Answer 1


Once you know (you didn't question that) that $a = 3$, then knowing 4 goes to 17, using $f(x) = 3x + b$, we just substitute $x = 4$ to get $3 * 4 + b = 12 + b = 17 \mod 26$, where we can easily see that $b= 5$ does the job.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.