diff --git a/Signer.php b/Signer.php index 2d364b6..3979d7b 100644 --- a/Signer.php +++ b/Signer.php @@ -62,9 +62,9 @@ public function sign($data) $base = pack('v', strlen($base)) . $base; // Modular exponentiation - $dec = bcpowmod(self::reverseToDecimal($base), $this->power, $this->modulus); + $dec = bcpowmod(self::reverseToDecimal($base), $this->power, $this->modulus, 0); - // Convert result to hexadecimal + // Convert to hexadecimal $hex = self::dec2hex($dec); // Fill empty bytes with zeros @@ -199,7 +199,8 @@ private static function hex2decBC($hex) { return bcadd( (string)hexdec($last), - bcmul('16', self::hex2decBC($rest)) + bcmul('16', self::hex2decBC($rest), 0), + 0 ); } @@ -228,7 +229,7 @@ private static function dec2hex($dec) */ private static function dec2hexBC($dec) { $remainder = bcmod($dec, '16'); - $quotient = bcdiv(bcsub($dec, $remainder), '16'); + $quotient = bcdiv(bcsub($dec, $remainder, 0), '16', 0); if ($quotient == 0) { return dechex($remainder);