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).
To submit a flag, log in.