How to solve $a^x\bmod n=b$

64 Views Asked by At

I am not good in maths, so I am stuck in a small problem.

How can I solve this equation?

$$a^x\bmod n=b$$

for example

$$11^x\bmod 23=15$$

How can I find what is the value of $x$?

1

There are 1 best solutions below

0
On BEST ANSWER

This is known as the discrete logarithm problem, and it is believed to be a hard problem in general.

(In fact if it isn't "hard", in an appropriate technical sense, the security of many widely-used cryptographic primitives would break down).

For numbers as small as the one in your example, you can get through with simple trial-and-error: Keep multiplying by $11$ (and reducing modulo $23$) until you reach $15$.

When the numbers get too large for trial-and-error, you're in trouble. There are known methods that are somewhat faster than trying everything, but they're still not fast, and they're not simple to describe at all.