26 #require_once 'Zend/Crypt/Math/BigInteger/Interface.php'; 60 public function add($left_operand, $right_operand)
62 $result = gmp_add($left_operand, $right_operand);
73 public function subtract($left_operand, $right_operand)
75 $result = gmp_sub($left_operand, $right_operand);
88 public function compare($left_operand, $right_operand)
90 $result = gmp_cmp($left_operand, $right_operand);
102 public function divide($left_operand, $right_operand)
104 $result = gmp_div($left_operand, $right_operand);
116 public function modulus($left_operand, $modulus)
118 $result = gmp_mod($left_operand, $modulus);
129 public function multiply($left_operand, $right_operand)
131 $result = gmp_mul($left_operand, $right_operand);
142 public function pow($left_operand, $right_operand)
144 $result = gmp_pow($left_operand, $right_operand);
156 public function powmod($left_operand, $right_operand, $modulus)
158 $result = gmp_powm($left_operand, $right_operand, $modulus);
181 while (strlen($operand)) {
182 $ord = ord(substr($operand, 0, 1));
184 $operand = substr($operand, 1);
195 $bigInt = gmp_strval($operand, 16);
196 if (strlen($bigInt) % 2 != 0) {
197 $bigInt =
'0' . $bigInt;
198 }
else if ($bigInt[0] >
'7') {
199 $bigInt =
'00' . $bigInt;
201 $return = pack(
"H*", $bigInt);
212 while(strlen($hex)) {
213 $hex = hexdec(substr($operand, 0, 4));
214 $dec = gmp_add(gmp_mul($return, 65536), $hex);
215 $operand = substr($operand, 4);
integerToBinary($operand)
divide($left_operand, $right_operand)
powmod($left_operand, $right_operand, $modulus)
compare($left_operand, $right_operand)
binaryToInteger($operand)
modulus($left_operand, $modulus)
pow($left_operand, $right_operand)
add($left_operand, $right_operand)
subtract($left_operand, $right_operand)
multiply($left_operand, $right_operand)