From 2d7aadc689346f46613ce5dc7010f72ed8eb0baf Mon Sep 17 00:00:00 2001 From: terrafrost Date: Fri, 12 Oct 2018 23:04:57 -0500 Subject: [PATCH] Hash: tweaks to hash pre-computation --- phpseclib/Crypt/Hash.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/phpseclib/Crypt/Hash.php b/phpseclib/Crypt/Hash.php index 65c8449c..1042463f 100644 --- a/phpseclib/Crypt/Hash.php +++ b/phpseclib/Crypt/Hash.php @@ -126,6 +126,15 @@ class Crypt_Hash */ var $key = false; + /** + * Computed Key + * + * @see self::_computeKey() + * @var string + * @access private + */ + var $computedKey = false; + /** * Outer XOR (Internal HMAC) * @@ -209,6 +218,11 @@ class Crypt_Hash */ function _computeKey() { + if ($this->key === false) { + $this->computedKey = false; + return; + } + if (strlen($this->key) <= $this->b) { $this->computedKey = $this->key; return;