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 :)
Top comments (0)