From 048635669e294effb6c7136c4b179921c15867bc Mon Sep 17 00:00:00 2001 From: terrafrost Date: Sat, 13 Oct 2018 08:20:09 -0500 Subject: [PATCH] Crypt/Base: create hmac object outside of while loop --- phpseclib/Crypt/Base.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phpseclib/Crypt/Base.php b/phpseclib/Crypt/Base.php index 97a61871..63e8ec80 100644 --- a/phpseclib/Crypt/Base.php +++ b/phpseclib/Crypt/Base.php @@ -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);