Hacking Random Generator (linear congruential generator)

rodiongork

Rodion Gorkovenko

Posted on February 12, 2020

Hacking Random Generator (linear congruential generator)

New problem: Cracking "LCG" Random Generator @ CodeAbbey

Default random generators in some languages (Python, PHP7, JavaScript) switched to XorShift or Mersenne Twister. However in others - most notably, Java and linux/posix rand used in C/C++ - it still uses linear congruential generator in very simple form:

X_next = (A * X_cur + C) % M

The new problem at CodeAbbey is dedicated to exercise of hacking such generator. I.e. about predicting next results after observing few first ones.

This both helps to get better understanding of modular arithmetic - and to remember that default random generators shouldn't be used for hashing or encrypting sensitive data - or building online casinos :)

💖 💪 🙅 🚩
rodiongork
Rodion Gorkovenko

Posted on February 12, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related