Is there a good open source script/library for php, that will produce cryptographic secure Pseudo-Random-Numbers?
Asked
Active
Viewed 496 times
2 Answers
2
Probably the best way is to simply read from /dev/urandom, but a plethora of examples can be found in this article (sorry for the non SO link):
http://timoh6.github.io/2013/11/05/Secure-random-numbers-for-PHP-developers.html
There is also a php library if this is what you are looking for:

isaac9A
- 903
- 4
- 12
- 30
2
At http://php.net/manual/en/function.mt-rand.php, there is a warning that says, "This function does not generate cryptographically secure values, and should not be used for cryptographic purposes. If you need a cryptographically secure value, consider using openssl_random_pseudo_bytes() instead". See http://php.net/manual/en/function.openssl-random-pseudo-bytes.php.

mti2935
- 11,465
- 3
- 29
- 33