| | |
| | | */ |
| | | function _getCnonce() |
| | | { |
| | | if (file_exists('/dev/urandom') && $fd = @fopen('/dev/urandom', 'r')) { |
| | | if (@file_exists('/dev/urandom') && $fd = @fopen('/dev/urandom', 'r')) { |
| | | return base64_encode(fread($fd, 32)); |
| | | |
| | | } elseif (file_exists('/dev/random') && $fd = @fopen('/dev/random', 'r')) { |
| | | } elseif (@file_exists('/dev/random') && $fd = @fopen('/dev/random', 'r')) { |
| | | return base64_encode(fread($fd, 32)); |
| | | |
| | | } else { |
| | | $str = ''; |
| | | mt_srand((double)microtime()*10000000); |
| | | for ($i=0; $i<32; $i++) { |
| | | $str .= chr(mt_rand(0, 255)); |
| | | } |