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.';
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__;
93 $duplicate = 256 % $popsize;
96 for ($i = 0; $i < $length; $i++) {
99 }
while ($n < $duplicate);
102 $str .= $population[$n];
110 if (strlen($s1) != strlen($s2)) {
115 $length = strlen($s1);
116 for ($i = 0; $i < $length; $i++) {
117 $result &= ($s1[$i] == $s2[$i]);
if(!defined('ADODB_ERROR_HANDLER_TYPE')) define('ADODB_ERROR_HANDLER_TYPE' E_USER_ERROR
static randomString($length, $population=null)
static getBytes($num_bytes)
if($list_of_literals) if(!empty($literals)) if(!empty($literals)) $result
Analyse literals to prepend the N char to them if their contents aren't numeric.