Smooth-order group
The difficulty of the discrete logarithm depends not on the size of p, but on the structure of the group order. The following p is greater than 80 bits, but p-1 consists only of small prime factors. Such numbers are called smooth.
Pohlig and Hellman showed this: with a smooth order, a large problem is divided into several very small problems. For each prime divisor q of p-1, we descend into a small subgroup:
g_q = g^((p-1)/q) mod p
h_q = h^((p-1)/q) mod p
g_q^(x mod q) = h_q -> x mod q (atigi q ta variant)
For each q, we brute-force x mod q (here q < 10⁶, which means a few hundred thousand steps), then we combine all the remainders using the Chinese Remainder Theorem to recover x. The product of the moduli (i.e., the qs) is equal to p-1 — thus the answer is unique.
p = 21828401477478492502354191407
p - 1 = 2 * 180811 * 271261 * 361769 * 748093 * 822229
g = 5
A = 12837842079537664901601609090
Find Alice's secret number a.
Flag: BAYROQ{DH_silliq_tartib_<a>}