A library of pseudorandom number generators (PRNGs), ideal for playing with cryptography. These are not built to be secure and will get you hacked if deployed in a real system.
pnc contains standalone, clean implementations. You should be able to:
- Generate numbers as part of a larger system.
- Attack third-party generators to recover their internal state.
- Understand and modify the code to better understand how the generators work.
Install Golang on your machine.
Run go get github.com/46bit/pnc
to fetch the code.
Try the examples in $GOPATH/github.com/46bit/pnc/examples
.
- Mersenne Twister [1, 2], an incredibly common, insecure PRNG.
- Linear Congruential Generator [1], a common but defective PRNG.
- Tausworthe Generator [1, 2], a weak PRNG once used in slot machines.
- Blum Blum Shub [1, 2], a CSPRNG secured by integer factorisation.
- Blum Micali [1], a CSPRNG secured by the discrete-logarithm problem (DLP).
- Dual EC DRBG [1, 2, 3], a famously backdoored CSPRNG secured by elliptic curve DLP.
Built by Michael Mokrysz from December 2013. Licensed under MIT and formerly known as Pinocchio.