4

I have my Network Security finals. In elgamal cryptosystem, I am often encountering these equations like this

3 = (10^XA) mod 19

now everywhere I am finding only method to solve it, where I start at 0 and keep changing value for XA until the equation satisfies.

Is there any better method to solve using pen and paper + calculator?

Pragyan
  • 141
  • 2

2 Answers2

3

You could try Baby-Step Giant-Step:

  1. First calculate $10^b$ for $b=0\dots 4$: $1, 10, 10\cdot 10 = 5, 10\cdot 5 = 12, 10\cdot 12 = 6$, and
  2. store them in a table manner ($\alpha_i = 10^i \bmod 19$).
  3. Then invert your target value $3^{-1} = 13$ and multiply $10^4 = 6$ until you get one of the values $10^b$ calculated in the first step: $13, 6\cdot 13 = 2, 6\cdot 2 = 12$, and
  4. use that $10^3 = 3^{-1}\cdot 10^{2\cdot 4}$ implies $3 = 10^{8-3} = 10^5$.

For the first step you have to calculate about $\sqrt{19}$ multiplications (I stopped at $b=4$ to show you the full algorithm), then you need an inversion (on wikipedia they invert 6 instead, so invert what's easier for you), and finally you need again at most $\sqrt{19}$ multiplications.

kelalaka
  • 49,797
  • 12
  • 123
  • 211
j.p.
  • 1,657
  • 20
  • 17
0

Use brute force plus common sense. It is likely that the question has been specially chosen for this.

With this modulus, multiplying an even number by 10 halves it. Multiplying an odd number by 10 halves it (rounding down) and adds 10.

Given this, you can do it on your fingers with no pencil or paper.