Commit 564048a1 by Qiang Xue

Merge pull request #2422 from sarciszewski/patch-1

Inconsistently insecure
parents 08db9285 660d3a57
...@@ -336,13 +336,10 @@ class BaseSecurity ...@@ -336,13 +336,10 @@ class BaseSecurity
} }
// Get 20 * 8bits of pseudo-random entropy from mt_rand(). // Get 20 * 8bits of pseudo-random entropy from mt_rand().
$rand = ''; $rand = openssl_random_pseudo_bytes(20);
for ($i = 0; $i < 20; ++$i) {
$rand .= chr(mt_rand(0, 255));
}
// Add the microtime for a little more entropy. // Add the microtime for a little more entropy.
$rand .= microtime(); $rand .= microtime(true);
// Mix the bits cryptographically into a 20-byte binary string. // Mix the bits cryptographically into a 20-byte binary string.
$rand = sha1($rand, true); $rand = sha1($rand, true);
// Form the prefix that specifies Blowfish algorithm and cost parameter. // Form the prefix that specifies Blowfish algorithm and cost parameter.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment