Hash: fix issues with _computeKey

This commit is contained in:
terrafrost 2019-03-08 08:34:33 -06:00
parent ca76d3913f
commit 492562e034

View File

@ -216,7 +216,7 @@ class Crypt_Hash
* *
* @access private * @access private
*/ */
function _computeKey() function _computeKey($mode)
{ {
if ($this->key === false) { if ($this->key === false) {
$this->computedKey = false; $this->computedKey = false;
@ -332,7 +332,7 @@ class Crypt_Hash
default: default:
$this->hash = MHASH_SHA1; $this->hash = MHASH_SHA1;
} }
$this->_computeKey(); $this->_computeKey(CRYPT_HASH_MODE_MHASH);
return; return;
case CRYPT_HASH_MODE_HASH: case CRYPT_HASH_MODE_HASH:
switch ($hash) { switch ($hash) {
@ -349,7 +349,7 @@ class Crypt_Hash
default: default:
$this->hash = 'sha1'; $this->hash = 'sha1';
} }
$this->_computeKey(); $this->_computeKey(CRYPT_HASH_MODE_HASH);
return; return;
} }
@ -375,7 +375,7 @@ class Crypt_Hash
$this->ipad = str_repeat(chr(0x36), $this->b); $this->ipad = str_repeat(chr(0x36), $this->b);
$this->opad = str_repeat(chr(0x5C), $this->b); $this->opad = str_repeat(chr(0x5C), $this->b);
$this->_computeKey(); $this->_computeKey(CRYPT_HASH_MODE_INTERNAL);
} }
/** /**