mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-12-27 19:54:57 +00:00
- changed $fp to $urandom (thanks, Ben!)
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@144 21d32557-59b3-4da0-833f-c5933fad653e
This commit is contained in:
parent
a4d39a9e66
commit
27700e9ca7
@ -68,7 +68,7 @@ function crypt_random($min = 0, $max = 0x7FFFFFFF)
|
|||||||
$urandom = @fopen('/dev/urandom', 'rb');
|
$urandom = @fopen('/dev/urandom', 'rb');
|
||||||
}
|
}
|
||||||
if (!is_bool($urandom)) {
|
if (!is_bool($urandom)) {
|
||||||
extract(unpack('Nrandom', fread($fp, 4)));
|
extract(unpack('Nrandom', fread($urandom, 4)));
|
||||||
|
|
||||||
// say $min = 0 and $max = 3. if we didn't do abs() then we could have stuff like this:
|
// say $min = 0 and $max = 3. if we didn't do abs() then we could have stuff like this:
|
||||||
// -4 % 3 + 0 = -1, even though -1 < $min
|
// -4 % 3 + 0 = -1, even though -1 < $min
|
||||||
|
Loading…
Reference in New Issue
Block a user