Get random numbers
# cat get.py
# python get.py
Linear congruential generator
random_n+1 = ((a * random_n) + c) % m
a = multiplier
c = increment
m = modulus
Get modulus
# cat get_modulus.py
# python get_modulus.py
Modulus = 4294967295 == 2**32 -1
Solve the equation with Wolfram Alfa and get (a, c)
r0 = 855109115
r1 = 895402096
r2 = 2391280583
r3 = 300480802
m = 4294967295
r1 = ((a*r0) + b) mod m
r2 = ((a*r1) + b) mod m
r3 = ((a*r2) + b) mod m
a = 6771334847
c = 6621298821
Get the flag
# cat get_flag.py
# python get_flag.py
References
https://en.wikipedia.org/wiki/Linear_congruential_generator
http://security.stackexchange.com/questions/4268/cracking-a-linear-congruential-generator
No comments:
Post a Comment