paragonie/random_compat
PHP 5 polyfill for random_bytes() and random_int(), providing secure, cryptographically strong randomness on older PHP versions. Uses the best available system sources and falls back safely, helping apps generate tokens, keys, IDs, and nonces consistently across environments.
/dev/urandom cannot be read on Unix-based operating systems,
a Exception with a specific error message will be thrown.MissingReturnType check (that is to say, demoted it to "info").totallyTyped="false").v9.99.99 and it's causing stuff to break, see this section of the README for the solution to your problem.psalm.xml file with explanations for why each assertion is suppressed./ with DIRECTORY_SEPARATOR.
For most users (i.e. not running Windows) this change should be of zero consequence. For everyone else, it should mean random_compat magically works when it didn't before.v9.99.99 tag.polyfill keyword to composer.json^1 to ^1|^2 if you want other changes (i.e. better compatibility with type-safety), because the v2 branch is where most of the development effort is focused. Continued support for v1.x is considered "only for emergencies".Backported changes from version 2:
random_int() caused by misusing
the library (really you should only ever include lib/random.php and never any
of the other files). See #125.mcrypt_create_iv() from being used.
See #111.lib/error_polyfill.php to resolve corner cases.More Psalm integration fixes.
Prevent function already declared error for random_int() caused by misusing the library (really you should only ever include lib/random.php and never any of the other files). See #125.
Apparently psalm locally works, but psalm on Travis CI likes to randomly fail to recognize that a constant exists when it does.
Yeah.... no.
I didn't bother updating the changelog. It's a ditto for 2.0.6.
mcrypt_create_iv() from being used.
See #111.Please speak up if this change causes issues for you.
lib/error_polyfill.php to resolve corner cases.Added a consistency check (discovered by Taylor Hornby in his PHP encryption library). It wasn't likely causing any trouble for us.
Update comment in random.php
Update comment in random.php
Due to downstream errors, the OpenSSL removal now belongs in version 2.0.0.
Restored OpenSSL in the version 1 branch in preparation to remove OpenSSL in version 2.
open_baseir check. Thanks @narfbgopen_baseir check. Thanks @narfbgRemoved openssl_random_pseudo_bytes() entirely. If you are using random_compat in PHP on a Unix-like OS but cannot access /dev/urandom, version 1.3+ will throw an Exception. If you want to trust OpenSSL, feel free to write your own fallback code. e.g.
try {
$bytes = random_bytes(32);
} catch (Exception $ex) {
$strong = false;
$bytes = openssl_random_pseudo_bytes(32, $strong);
if (!$strong) {
throw $ex;
}
}
/dev/urandom is not
accessible to PHP, skip mcrypt (which just fails before giving OpenSSL
a chance and was morally equivalent to not offering OpenSSL at all).How can I help you explore Laravel packages today?