A message has been converted to ASCII and then encrypted with the formula: $$ax+b \equiv n \pmod {215475}$$ The encrypted message is: 091238 057542 070713 195800 138772 029721 035480

Each group of 6 numbers represents 2 letters. I know that the first 4 letters are W i s k

What I did was the following: W i in ASCII is 087105, so $$ 087105a+b\equiv091238\pmod{215475}. $$

s k in ASCII is 115107, so $$ 115107a+b\equiv057542\pmod{215475}. $$

Subtracting I get, $$ 28002a\equiv-33696\equiv181779\pmod{215475}. $$

$28002$ is not coprime to $215475$, so what do I do now?

How do I go about solving this? And why isn't what I am doing working?


You're right that not being able to fully reduce the equation by multiplying through by $28002^{-1}$ makes the equation a bit trickier to solve. One thing you could do is just do a brute force search for an $a$ such that $28002a \equiv 181779 \text{ mod } 215475$. There's only around two hundred thousand values to check which is trivial for a modern computer. Doing this yields $28002 * 3677 \equiv 181779 \text{ mod } 215475$. Plugging this $a$ back into the original equations you find that $b = 2003$. Hence the complete equation is:

$3677x + 2003 \equiv n \text{ mod } 215475$

  • $\begingroup$ Thank you very much, bruteforcing it seems indeed to be the easy option! $\endgroup$ – user34734 Jun 7 '16 at 16:08
  • 1
    $\begingroup$ If you get problems that are too large to bruteforce, you can reduce the problem into $28002a \equiv 181779 \pmod{215475/3}$ (which has 1 solution) and $28002a \equiv 181779 \pmod{3}$ (which has 3 solutions, $a=0,1,2$), and then use CRT to reconstruct the 3 solutions for the original equation. $\endgroup$ – poncho Jun 7 '16 at 17:06

Your Answer

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