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?