diff --git a/phpseclib/Crypt/RSA.php b/phpseclib/Crypt/RSA.php index 9670c01a..cd116b56 100644 --- a/phpseclib/Crypt/RSA.php +++ b/phpseclib/Crypt/RSA.php @@ -2423,7 +2423,7 @@ class RSA $db = $maskedDB ^ $dbMask; $lHash2 = substr($db, 0, $this->hLen); $m = substr($db, $this->hLen); - if ($lHash != $lHash2) { + if (!$this->_equals($lHash, $lHash2)) { user_error('Decryption error'); return false; } diff --git a/phpseclib/Math/BigInteger.php b/phpseclib/Math/BigInteger.php index 075f0f34..32320b43 100644 --- a/phpseclib/Math/BigInteger.php +++ b/phpseclib/Math/BigInteger.php @@ -2908,7 +2908,7 @@ class BigInteger // (will always result in a smaller number. ie. ~1 isn't 1111 1110 - it's 0) $temp = $this->toBytes(); if ($temp == '') { - return ''; + return $this->_normalize(new Math_BigInteger()); } $pre_msb = decbin(ord($temp[0])); $temp = ~$temp;