Skip to main content
Challenges Discrete logarithm (small p)
Cryptography Medium Discrete logarithm Solves: 7

Discrete logarithm (small p)

Author: CyberSamSU
Points
45

In an ordinary logarithm, finding x from the equation g^x = h is easy. However, in modular arithmetic, solving the equation g^x ≡ h (mod p) — the discrete logarithm problem — is considered very difficult. The Diffie-Hellman key exchange and the ElGamal cipher rely precisely on this difficulty.

"Difficult" means only when p is large. In this challenge, p is only 7 digits long, so simple brute-force is sufficient: calculate g^1, g^2, g^3, ... sequentially and find the step that equals h.

Find x from the following equation:

p = 2453027
g = 2
h = 53997

g^x mod p = h

Answer: only the number — in decimal format, without spaces and extra characters (for example 1234).

Hints 3
Opening a hint reduces the points you get for solving this challenge.
Hint 1 −4 pts Log in
Hint 2 −9 pts Log in
Hint 3 −13 pts Log in
To submit a flag, log in.

First solvers

1. W.o.X 17.09.2026
2. Лазиз 04.10.2026
3. testrejim 09.10.2026
4. Mirjaxon Qaxxarov 26.10.2026
5. Odam 05.11.2026
6. arcanum 11.11.2026
7. Jasmin Xuseinova 15.11.2026