1
$\begingroup$

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:

$15a\equiv-7\equiv19\pmod{26}$

$a\equiv19/15\pmod{26}$

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

$b=5$

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

$\endgroup$
3
  • 1
    $\begingroup$ Doesn't your question simply boil down to: "How to get the multiplicative inverse of an element modulo n?" $\endgroup$ Commented Aug 18, 2012 at 22:29
  • 2
    $\begingroup$ en.wikipedia.org/wiki/Modular_multiplicative_inverse $\endgroup$ Commented Aug 18, 2012 at 22:32
  • 2
    $\begingroup$ You have $a$, and you have values for $x$ and $c$. Solve for $b$. This question would be more appropriate at Maths SE. $\endgroup$ Commented Aug 19, 2012 at 0:15

1 Answer 1

1
$\begingroup$

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.

$\endgroup$

Your Answer

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

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