D
D
daniilkening2022-02-18 21:01:08
Burglary protection
daniilkening, 2022-02-18 21:01:08

How to hack linear congruential random number generator from 0 to 36?

Hello, for educational purposes, I want to know if it is possible to hack such a generator? The Pawno programming language has a random function which is based on lcg. The default m factor in this programming language is 2 to the power of 31. How many input values ​​are needed to open this generator?

I found a code that seems to solve this problem. But it's not entirely clear how it works...
https://github.com/ctf-x/ctfx-problems-2016/tree/m...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Michael, 2022-02-18
@daniilkening

What do you mean by "open"? Learn to predict the next value? PRNG is in principle a deterministic function, the previous value uniquely determines the next one (recurrent function).
If we are talking about determining the coefficients a and c, then this is done elementarily: do seed=0, the next value of the generator is equal to c. Do seed = 1 - the next value of the generator is (a + c) % m, from where, given m and c, a is calculated.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question