DebugDecorator
in package
implements
GmpMathInterface
Debug helper class to trace all calls to math functions along with the provided params and result.
Table of Contents
Interfaces
Properties
- $adapter : GmpMathInterface
- $writer : callable
Methods
- __construct() : mixed
- add() : GMP
- Adds two numbers
- baseConvert() : string
- bitwiseAnd() : GMP
- Performs a logical AND between two values.
- bitwiseXor() : GMP
- Performs a logical XOR between two values.
- cmp() : int
- Compares two numbers
- decHex() : string
- Converts a decimal string to hexadecimal.
- digestInteger() : GMP
- div() : GMP
- Divides a number by another.
- equals() : bool
- gcd2() : GMP
- getEcMath() : mixed
- {@inheritDoc}
- getModularArithmetic() : ModularArithmetic
- getNumberTheory() : NumberTheory
- hexDec() : int|string
- Converts an hexadecimal string to decimal.
- intToFixedSizeString() : string
- intToString() : string
- inverseMod() : GMP
- isPrime() : bool
- Checks whether a number is a prime.
- jacobi() : int
- leftShift() : GMP
- Shifts bits to the left
- mod() : GMP
- Returns the remainder of a division
- mul() : GMP
- Multiplies a number by another.
- nextPrime() : GMP
- Gets the next known prime that is greater than a given prime.
- pow() : GMP
- Raises a number to a power.
- powmod() : GMP
- Calculates the modular exponent of a number.
- rightShift() : GMP
- Shifts bits to the right
- stringToInt() : GMP
- sub() : GMP
- Substract one number from another
- toString() : string
- Returns the string representation of a returned value.
- call() : mixed
- write() : mixed
Properties
$adapter
private
GmpMathInterface
$adapter
$writer
private
callable
$writer
Methods
__construct()
public
__construct(GmpMathInterface $adapter[, callable|null $callback = null ]) : mixed
Parameters
- $adapter : GmpMathInterface
- $callback : callable|null = null
add()
Adds two numbers
public
add(GMP $augend, GMP $addend) : GMP
Parameters
- $augend : GMP
- $addend : GMP
Tags
Return values
GMPbaseConvert()
public
baseConvert(string $value, int $fromBase, int $toBase) : string
Parameters
- $value : string
- $fromBase : int
- $toBase : int
Tags
Return values
stringbitwiseAnd()
Performs a logical AND between two values.
public
bitwiseAnd(GMP $first, GMP $other) : GMP
Parameters
- $first : GMP
- $other : GMP
Tags
Return values
GMPbitwiseXor()
Performs a logical XOR between two values.
public
bitwiseXor(GMP $first, GMP $other) : GMP
Parameters
- $first : GMP
- $other : GMP
Tags
Return values
GMPcmp()
Compares two numbers
public
cmp(GMP $first, GMP $other) : int
Parameters
- $first : GMP
- $other : GMP
Tags
Return values
int —less than 0 if first is less than second, 0 if equal, greater than 0 if greater than.
decHex()
Converts a decimal string to hexadecimal.
public
decHex(string $decString) : string
Parameters
- $decString : string
Tags
Return values
stringdigestInteger()
public
digestInteger(GMP $m) : GMP
Parameters
- $m : GMP
Tags
Return values
GMPdiv()
Divides a number by another.
public
div(GMP $dividend, GMP $divisor) : GMP
Parameters
- $dividend : GMP
- $divisor : GMP
Tags
Return values
GMPequals()
public
equals(GMP $first, GMP $other) : bool
Parameters
- $first : GMP
- $other : GMP
Tags
Return values
boolgcd2()
public
gcd2(GMP $a, GMP $m) : GMP
Parameters
- $a : GMP
- $m : GMP
Tags
Return values
GMPgetEcMath()
{@inheritDoc}
public
getEcMath(GeneratorPoint $generatorPoint, mixed $input) : mixed
Parameters
- $generatorPoint : GeneratorPoint
- $input : mixed
Tags
getModularArithmetic()
public
getModularArithmetic(GMP $modulus) : ModularArithmetic
Parameters
- $modulus : GMP
Tags
Return values
ModularArithmeticgetNumberTheory()
public
getNumberTheory() : NumberTheory
Tags
Return values
NumberTheoryhexDec()
Converts an hexadecimal string to decimal.
public
hexDec(string $hexString) : int|string
Parameters
- $hexString : string
Tags
Return values
int|stringintToFixedSizeString()
public
intToFixedSizeString(GMP $x, int $byteSize) : string
Parameters
- $x : GMP
- $byteSize : int
Tags
Return values
stringintToString()
public
intToString(GMP $x) : string
Parameters
- $x : GMP
Tags
Return values
stringinverseMod()
public
inverseMod(GMP $a, GMP $m) : GMP
Parameters
- $a : GMP
- $m : GMP
Tags
Return values
GMPisPrime()
Checks whether a number is a prime.
public
isPrime(GMP $n) : bool
Parameters
- $n : GMP
Tags
Return values
booljacobi()
public
jacobi(GMP $a, GMP $p) : int
Parameters
- $a : GMP
- $p : GMP
Tags
Return values
intleftShift()
Shifts bits to the left
public
leftShift(GMP $number, int $positions) : GMP
Parameters
- $number : GMP
-
Number to shift
- $positions : int
-
Number of positions to shift
Tags
Return values
GMPmod()
Returns the remainder of a division
public
mod(GMP $number, GMP $modulus) : GMP
Parameters
- $number : GMP
- $modulus : GMP
Tags
Return values
GMPmul()
Multiplies a number by another.
public
mul(GMP $multiplier, GMP $multiplicand) : GMP
Parameters
- $multiplier : GMP
- $multiplicand : GMP
Tags
Return values
GMPnextPrime()
Gets the next known prime that is greater than a given prime.
public
nextPrime(GMP $currentPrime) : GMP
Parameters
- $currentPrime : GMP
Tags
Return values
GMPpow()
Raises a number to a power.
public
pow(GMP $base, int $exponent) : GMP
Parameters
- $base : GMP
-
The number to raise.
- $exponent : int
-
The power to raise the number to.
Tags
Return values
GMPpowmod()
Calculates the modular exponent of a number.
public
powmod(GMP $base, GMP $exponent, GMP $modulus) : GMP
Parameters
- $base : GMP
- $exponent : GMP
- $modulus : GMP
Tags
Return values
GMPrightShift()
Shifts bits to the right
public
rightShift(GMP $number, int $positions) : GMP
Parameters
- $number : GMP
-
Number to shift
- $positions : int
-
Number of positions to shift
Tags
Return values
GMPstringToInt()
public
stringToInt(string $s) : GMP
Parameters
- $s : string
Tags
Return values
GMPsub()
Substract one number from another
public
sub(GMP $minuend, GMP $subtrahend) : GMP
Parameters
- $minuend : GMP
- $subtrahend : GMP
Tags
Return values
GMPtoString()
Returns the string representation of a returned value.
public
toString(GMP $value) : string
Parameters
- $value : GMP
Tags
Return values
stringcall()
private
call(string $func, array<string|int, mixed> $args) : mixed
Parameters
- $func : string
- $args : array<string|int, mixed>
write()
private
write(string $message) : mixed
Parameters
- $message : string