Skip to main content
Challenges LCG: finding parameters a and c
Cryptography Medium LCG Solves: 7

LCG: finding parameters a and c

Author: CyberSamSU
Points
45

Now the situation is more difficult: we don't have the source code of the generator. We only know the modulus (it is usually written in the documentation or guessed from the magnitude of the values), while the multiplier a and the increment c are secret.

But the LCG is linear, so the difference between consecutive states eliminates c:

x2 - x1 = (a*x1 + c) - (a*x0 + c) = a * (x1 - x0)   (mod m)

So a = (x2 - x1) * (x1 - x0)^(-1) mod m, then c = (x1 - a*x0) mod m. Since the modulus is a prime number, every non-zero difference has an inverse element.

Captured 6 consecutive internal states (modulus m = 2147483647):

x_0 = 1249239498
x_1 = 1789362674
x_2 = 663776103
x_3 = 1345825514
x_4 = 919511159
x_5 = 147564790

Find a and c and assemble the flag like this: BAYROQ{PRNG_lcg_a_<a>_c_<c>} — both numbers are in the range 0 .. m-1, written in decimal format.

It is easy to check your answer: recalculate from x_2 to x_5 with the found a and c — everything should match.

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. Лазиз 04.10.2026
2. testrejim 09.10.2026
3. Mirjaxon Qaxxarov 27.10.2026
4. Odam 05.11.2026
5. arcanum 11.11.2026
6. Jasmin Xuseinova 15.11.2026
7. Kamron_99 16.11.2026