1
$\begingroup$

I'm tired and can't seem to get the right answer for the following exercise:

Alice sends a message to Bob, but he doesn't know the key. He knows only that the first two plaintext letters are C and R.

  • The ciphertext is turgifsfsferbi.
  • The plaintext is cryptananalyst.

The first two plaintext letters are ${\rm C} = 2$ and ${\rm R} = 17$, while the corresponding ciphertext letters are ${\rm T} = 19$ and ${\rm U} = 20$. The encryption formula is $f(x) = ax+b$, so we have:

\begin{aligned} 19 &= \phantom{0}2a+b \\ 20 &= 17a+b, \end{aligned}

which I solved to get $-1=-15a \implies a=15$ and $b=3$.

For decryption, we use the formula $f(c)=a^{-1}(c-b) \bmod 26$. The inverse of $a=15$ modulo $26$ is $a^{-1} = 7$, so for the first ciphertext letter I get:

$$7 \times (19-3) \bmod 26 = 7 \times 16 \bmod 26 = 8 = {\rm I} \ne {\rm C}.$$

So where is my mistake?

$\endgroup$
1
  • $\begingroup$ Hi, Network, and welcome to Crypto Stack Exchange. I've tried to copyedit your question to make it easier to read, but there's a couple of places that I wasn't 100% sure of. Could you please check that I haven't made any mistakes? If you spot any, please do let me know, or just edit your question to fix them. Thanks! $\endgroup$ Commented Dec 4, 2017 at 16:52

1 Answer 1

1
$\begingroup$

If I'm reading your question right, you've made two simple math mistakes:

  1. The solution to $-1 \equiv -15a \pmod{26}$ isn't $a = 15$; it's $a \equiv 15^{-1} \pmod{26}$, or $a = 7$.

  2. I'm not sure where you got $b = 3$, but it's not correct, either. The right solution, using the correct value of $a = 7$, is $b = 19 - 2a = 19 - 14 = 5$.

(FWIW, using the incorrect value $a = 15$ should've given you either $b = 15$ or $b = 25$, depending on which of the two original congruences you plugged the wrong $a$ into.)

With the correct values of $a$ and $b$, your decryption formula works just fine: $a^{-1} = 7^{-1} \equiv 15 \pmod{26}$, so:

\begin{aligned} 15 \times (19 - 5) &\equiv \phantom{0}2 \pmod{26} \\ 15 \times (20 - 5) &\equiv 17 \pmod{26}. \end{aligned}

Both of your mistakes seem like simple lapses of concentration. Maybe you just need to take a break from your homework and go get some sleep first.

$\endgroup$
1
  • $\begingroup$ thanks you. yes its my mistake really because i didn't slept. i don't know why im using 7 and i didn't use the inverse of 7=15..now all is clear $\endgroup$
    – Network
    Commented Dec 4, 2017 at 17:55

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.