Skip to content

Commit

Permalink
Crypt/Base: create hmac object outside of while loop
Browse files Browse the repository at this point in the history
  • Loading branch information
terrafrost committed Oct 13, 2018
1 parent f0f7350 commit 0486356
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions phpseclib/Crypt/Base.php
Expand Up @@ -696,10 +696,10 @@ function setPassword($password, $method = 'pbkdf2')
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);
Expand Down

0 comments on commit 0486356

Please sign in to comment.