Update PasswordHash.php

This commit is contained in:
laf
2014-02-23 22:05:22 +00:00
parent 18f9b89639
commit 519e4aba84

View File

@@ -48,10 +48,17 @@ class PasswordHash {
function get_random_bytes($count)
{
$output = '';
if (is_readable('/dev/urandom') &&
($fh = @fopen('/dev/urandom', 'rb'))) {
$output = fread($fh, $count);
fclose($fh);
$output = openssl_random_pseudo_bytes($count,$strong);
if(empty($count))
{
if (is_readable('/dev/urandom') &&
($fh = @fopen('/dev/urandom', 'rb')))
{
$output = fread($fh, $count);
fclose($fh);
}
}
if (strlen($output) < $count) {