tested on 5.6, 7.0, 7.1 and HHVM
This is a simple library for random number generation using random_bytes.
This library can generate strong, cryptographically secure random numbers,
and other useful random values.
This library depends on random_bytes
or the polyfill provided by ParagonIE.
If provided as a native extension the kernel CSPRNG is used. The polyfill handles
checking for appropriate sources of entropy if this is not available.
Simply use composer require blocktrail/simply-random ~1.0
.
Please refer to test.php
for example usage.
Most of the code used in this library was originally written by ircmaxell for random_compat. This library initially began as a fork with reduced complexity, and strong dependency on mcrypt.
see: http://timoh6.github.io/2013/11/05/Secure-random-numbers-for-PHP-developers.html
and more: https://news.ycombinator.com/item?id=6216101 http://security.stackexchange.com/questions/3936/is-a-rand-from-dev-urandom-secure-for-a-login-key/3939#3939