0
$\begingroup$

I was checking the following Affine Cipher / modular aritmethic exercise:

You intercept a ciphertext YFWD, which was ciphered using an affine cipher. You know that the plaintext starts in ST, find the cipher function and the plaintext $\pmod{26}$

I know $Y → S$ and $F→T$ , also $Y=24,S=18,T=19,F=5$

I've been trying to start from a congruence's equation system like this one:

$$\begin{cases}25 & \equiv & 18a+b\pmod{26}\\ 5 &\equiv & 20a+b \pmod{26}\end{cases}$$

From this point I can't find a way to solve the system, so any help will be really appreciated.

$\endgroup$
  • 1
    $\begingroup$ How would you solve the system if it were $25=18a+b$, $5=20a+b$? Do exactly that, but doing all the arithmetic modulo 26. $\endgroup$ – Gerry Myerson Feb 6 at 4:58
  • 1
    $\begingroup$ And note that 20 and 18 have no inverses in $\pmod{26}$. You will have multiple solutions to eliminate. $\endgroup$ – kelalaka Feb 6 at 8:41
2
$\begingroup$

Subtracting \begin{cases}25 \equiv & 18a+b\pmod{26}\\ 5 \equiv & 20a+b \pmod{26}\end{cases} gives $-20\equiv 2a\pmod{26}$, from which $a\equiv -10\equiv 3\pmod{13}$, that's $a\equiv 3\pmod{26}\lor a\equiv 16\pmod{26}$. In both cases, we get $b\equiv 23\pmod{26}$.

Consequently, the pairs $(a,b)$ of solutions modulo $26$ are: \begin{align} &(3,23)&&(16,23) \end{align}

$\endgroup$
0
$\begingroup$

Your equations are not quite correct: if the encryption function is $E(x) = ax+b \pmod{26}$ where $x \in \{0,\ldots,25\}$ then we know $E(18)=24$ and $E(19)=5$, so we have the system

$$\begin{cases} 18a + b & = & 24 &\pmod{26}\\ 19a + b & = &5 &\pmod{26} \end{cases}$$

Substracting the first equation from the second eliminates the $b$ and we get $a = 5-24 = -19 = 7 \pmod{26}$ and then substituting this back into the first we get $18\cdot7 + b = 24 \pmod{26}$, so that $b=24 - 126 = 2 \pmod{26}$, and so

$$E(x)=7x+2 \pmod{26}$$

So the decryption function (as the inverse of $7$ modulo $26$ is $15$: $7 \cdot 15 \equiv 1 \pmod{26}$ we get that

$$D(x) = 15(x-2) = 15x - 30 = 15x + 22 \pmod{26}$$

which allows us to decrypt the last part of the message WD = $(22,3)$ and $D(22)=14$, corresponding to O and $D(3)=15$ corresponding to P.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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