1
0
mirror of https://github.com/danog/phpseclib.git synced 2024-11-30 04:39:21 +01:00

Crypt/Base: create hmac object outside of while loop

This commit is contained in:
terrafrost 2018-10-13 08:20:09 -05:00
parent f0f7350045
commit 048635669e

View File

@ -696,10 +696,10 @@ class Crypt_Base
include_once 'Crypt/Hash.php';
}
$i = 1;
$hmac = new Crypt_Hash();
$hmac->setHash($hash);
$hmac->setKey($password);
while (strlen($key) < $dkLen) {
$hmac = new Crypt_Hash();
$hmac->setHash($hash);
$hmac->setKey($password);
$f = $u = $hmac->hash($salt . pack('N', $i++));
for ($j = 2; $j <= $count; ++$j) {
$u = $hmac->hash($u);