Search code examples
phpprng

Cryptographic secure PRNG-function for PHP?


Is there a good open source script/library for php, that will produce cryptographic secure Pseudo-Random-Numbers?


Solution

  • 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.