https://github.com/ototot/prngp
Collections of PRNG Predictions
https://github.com/ototot/prngp
crypto ctf ctf-tools mt19937 mt19937-64 predictors prng prng-predictions prng-predictor python
Last synced: about 1 month ago
JSON representation
Collections of PRNG Predictions
- Host: GitHub
- URL: https://github.com/ototot/prngp
- Owner: oToToT
- License: gpl-3.0
- Created: 2020-12-13T14:50:45.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-03-25T09:41:53.000Z (about 3 years ago)
- Last Synced: 2025-03-29T03:23:11.785Z (about 2 months ago)
- Topics: crypto, ctf, ctf-tools, mt19937, mt19937-64, predictors, prng, prng-predictions, prng-predictor, python
- Language: Python
- Homepage:
- Size: 25.4 KB
- Stars: 5
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PRNGP
The default (or widely used) PRNG implemented by most popular languages is not cryptographically secure. Here is some collections of some predictors. Feel free to send PR if you have some predictors not in this repo.
## LCG (Java)
[@giuliocandre/java-prng-predict](https://github.com/giuliocandre/java-prng-predict)
**NOTICE**: I didn't check this repo yet
## mt19937 (C++, Python, PHP)
If we have 624 output of mt19937, we could recover the whole state of mt19937.
Also, if we have 0, 1, 397 -th output of mt19937, we could predict the 624-th output of mt19937.
For PHP, if we have 0, 397 -th output of mt19937, we could recover the whole state of mt19937. See [this post](https://www.ambionics.io/blog/php-mt-rand-prediction).A predictor could be found in `mt19937/predictor.py`
## mt19937_64 (C++)
Just like mt19937, but we only need 312 output of mt19937_64 to recover the whole state of mt19937_64.
Also, if we have 0, 1, 156 -th output of mt19937_64, we could predict the 312-th output of mt19937_64.A predictor could be found in `mt19937_64/predictor.py`
## XorShift128+ (JavaScript in Chrome, Firefox, Node.js or any other V8 based platform)
Check [@TACIXAT/XorShift128Plus](https://github.com/TACIXAT/XorShift128Plus/blob/master/xs128p.py) for detail.
## Misc
LCGs are not secure at all: https://tailcall.net/blog/cracking-randomness-lcgs/