GetRandom() * 4. openssl_random_pseudo_bytes() * * See ERRATA.md for our reasoning behind this particular order */ if (!ini_get('open_basedir') && is_readable('/dev/urandom')) { // See random_bytes_dev_urandom.php require_once "random_bytes_dev_urandom.php"; } elseif (PHP_VERSION_ID >= 50307 && function_exists('mcrypt_create_iv')) { // See random_bytes_mcrypt.php require_once "random_bytes_mcrypt.php"; } elseif (extension_loaded('com_dotnet')) { // See random_bytes_com_dotnet.php require_once "random_bytes_com_dotnet.php"; } elseif (function_exists('openssl_random_pseudo_bytes')) { // See random_bytes_openssl.php require_once "random_bytes_openssl.php"; } else { /** * We don't have any more options, so let's throw an exception right now * and hope the developer won't let it fail silently. */ function random_bytes() { throw new Exception( 'There is no suitable CSPRNG installed on your system' ); } } } if (!function_exists('random_int')) { require_once "random_int.php"; } }