18 if (!defined(
'Auth_OpenID_RAND_SOURCE')) {
23 define(
'Auth_OpenID_RAND_SOURCE',
'/dev/urandom');
45 if (Auth_OpenID_RAND_SOURCE === null) {
48 $f = @fopen(Auth_OpenID_RAND_SOURCE,
"r");
50 $msg =
'Define Auth_OpenID_RAND_SOURCE as null to ' .
51 ' continue with an insecure random number generator.';
52 trigger_error($msg, E_USER_ERROR);
59 for ($i = 0; $i < $num_bytes; $i += 4) {
60 $bytes .= pack(
'L', mt_rand());
62 $bytes = substr($bytes, 0, $num_bytes);
64 $bytes = fread($f, $num_bytes);
82 if ($population === null) {
86 $popsize = strlen($population);
89 $msg =
'More than 256 characters supplied to ' . __FUNCTION__;
90 trigger_error($msg, E_USER_ERROR);
93 $duplicate = 256 % $popsize;
96 for ($i = 0; $i < $length; $i++) {
99 }
while (
$n < $duplicate);
102 $str .= $population[
$n];