From 011f6ad2001f2bded2c41ec4b3771bdc7ba0ebe5 Mon Sep 17 00:00:00 2001 From: terrafrost Date: Tue, 3 Apr 2018 20:23:47 -0500 Subject: [PATCH] BigInteger/PHP: make sure that zero is represented uniformly --- phpseclib/Math/BigInteger/Engines/PHP.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/phpseclib/Math/BigInteger/Engines/PHP.php b/phpseclib/Math/BigInteger/Engines/PHP.php index 1ec77e24..697fa94c 100644 --- a/phpseclib/Math/BigInteger/Engines/PHP.php +++ b/phpseclib/Math/BigInteger/Engines/PHP.php @@ -108,6 +108,10 @@ abstract class PHP extends Engine while (strlen($x)) { $this->value[] = self::bytes2int(self::base256_rshift($x, static::BASE)); } + + if ($this->value == [0]) { + $this->value = []; + } break; case 16: $x = (strlen($this->value) & 1) ? '0' . $this->value : $this->value;