|
static | randomRangePrimeInner (Engine $x, Engine $min, Engine $max) |
|
static | setBitmask ($bits) |
|
static | base256_lshift (&$x, $shift) |
|
static | slidingWindow (Engine $x, Engine $e, Engine $n, $class) |
|
static | randomRangePrimeOuter (Engine $min, Engine $max) |
|
static | randomRangeHelper (Engine $min, Engine $max) |
|
static | randomRangePrimeInner (Engine $x, Engine $min, Engine $max) |
|
static | minHelper (array $nums) |
|
static | maxHelper (array $nums) |
|
◆ __construct()
__construct |
( |
|
$x = 0 , |
|
|
|
$base = 10 |
|
) |
| |
◆ abs()
◆ add()
◆ between()
between |
( |
GMP |
$min, |
|
|
GMP |
$max |
|
) |
| |
◆ bitwise_and()
◆ bitwise_leftShift()
bitwise_leftShift |
( |
|
$shift | ) |
|
◆ bitwise_or()
◆ bitwise_rightShift()
bitwise_rightShift |
( |
|
$shift | ) |
|
◆ bitwise_xor()
◆ compare()
Compares two numbers.
Although one might think !$x->compare($y) means $x != $y, it, in fact, means the opposite. The reason for this is demonstrated thusly:
$x >
- y
x->compare($y) > 0 $x <
- y
x->compare($y) < 0 $x ==
- y
x->compare($y) == 0
Note how the same comparison operator is used. If you want to test for equality, use $x->equals($y).
{
Références $r, et value.
Référencé par GMP\between(), et GMP\toBits().
◆ createRecurringModuloFunction()
createRecurringModuloFunction |
( |
| ) |
|
Create Recurring Modulo Function
Sometimes it may be desirable to do repeated modulos with the same number outside of modular exponentiation
- Renvoie
- callable
Références $temp, et Engine\$value.
◆ divide()
Divides two BigIntegers.
Returns an array whose first element contains the quotient and whose second element contains the "common residue". If the remainder would be positive, the "common residue" and the remainder are the same. If the remainder would be negative, the "common residue" is equal to the sum of the remainder and the divisor (basically, the "common residue" is the first positive modulo).
- Paramètres
-
- Renvoie
- array{GMP, GMP}
Références GMP\normalize(), et value.
◆ equals()
Tests the equality of two numbers.
If you need to see if one number is greater than or less than another number, use BigInteger::compare()
- Paramètres
-
- Renvoie
- bool
Références value.
◆ extendedGCD()
Calculates the greatest common divisor and Bezout's identity.
Say you have 693 and 609. The GCD is 21. Bezout's identity states that there exist integers x and y such that 693*x + 609*y == 21. In point of fact, there are actually an infinite number of x and y combinations and which combination is returned is dependent upon which mode is in use. See Bezout's identity - Wikipedia for more information.
- Paramètres
-
- Renvoie
- GMP[]
Références $g, GMP\normalize(), et value.
◆ gcd()
Calculates the greatest common divisor
Say you have 693 and 609. The GCD is 21.
- Paramètres
-
- Renvoie
- GMP
Références $r, GMP\normalize(), et value.
◆ initialize()
◆ isNegative()
Is Negative?
- Renvoie
- bool
Références value.
◆ isOdd()
Is Odd?
- Renvoie
- bool
Références value.
◆ isValidEngine()
◆ make_odd()
Make the current number odd
If the current number is odd it'll be unchanged. If it's even, one will be added to it.
- Voir également
- self::randomPrime()
Références value.
◆ max()
static max |
( |
GMP ... |
$nums | ) |
|
|
static |
Return the maximum BigInteger between an arbitrary number of BigIntegers.
- Paramètres
-
- Renvoie
- GMP
◆ min()
static min |
( |
GMP ... |
$nums | ) |
|
|
static |
Return the minimum BigInteger between an arbitrary number of BigIntegers.
- Paramètres
-
- Renvoie
- GMP
◆ modInverse()
Calculates modular inverses.
Say you have (30 mod 17 * x mod 17) mod 17 == 1. x can be found using modular inverses.
- Paramètres
-
- Renvoie
- false|GMP
Références $temp, false, GMP\normalize(), et value.
◆ modPow()
◆ multiply()
◆ negate()
◆ normalize()
Normalize
Removes leading zeros and truncates (if necessary) to maintain the appropriate precision
- Paramètres
-
- Renvoie
- GMP
Références Engine\$bitmask, Engine\$precision, et $result.
Référencé par GMP\add(), GMP\bitwise_and(), GMP\bitwise_leftShift(), GMP\bitwise_or(), GMP\bitwise_rightShift(), GMP\bitwise_xor(), GMP\divide(), GMP\extendedGCD(), GMP\gcd(), GMP\modInverse(), GMP\multiply(), GMP\pow(), DefaultEngine\powModHelper(), GMP\rootInner(), et GMP\subtract().
◆ pow()
◆ powMod()
◆ powModInner()
powModInner |
( |
GMP |
$e, |
|
|
GMP |
$n |
|
) |
| |
|
protected |
◆ randomRange()
static randomRange |
( |
GMP |
$min, |
|
|
GMP |
$max |
|
) |
| |
|
static |
Generate a random number between a range
Returns a random number between $min and $max where $min and $max can be defined using one of the two methods:
BigInteger::randomRange($min, $max) BigInteger::randomRange($max, $min)
- Paramètres
-
- Renvoie
- GMP
◆ randomRangePrime()
static randomRangePrime |
( |
GMP |
$min, |
|
|
GMP |
$max |
|
) |
| |
|
static |
Generate a random prime number between a range
If there's not a prime within the given range, false will be returned.
- Paramètres
-
- Renvoie
- false|GMP
◆ randomRangePrimeInner()
Performs some post-processing for randomRangePrime
- Paramètres
-
- Renvoie
- GMP
Références value.
◆ rootInner()
Calculates the nth root of a biginteger.
Returns the nth root of a positive biginteger, where n defaults to 2
- Paramètres
-
- Renvoie
- GMP
Références $n, $root, GMP\normalize(), et value.
◆ scan1divide()
static scan1divide |
( |
GMP |
$r | ) |
|
|
static |
Scan for 1 and right shift by that amount
ie. $s = gmp_scan1($n, 0) and $r = gmp_div_q($n, gmp_pow(gmp_init('2'), $s));
- Paramètres
-
- Renvoie
- int
Références $r.
◆ subtract()
◆ testBit()
Tests if a bit is set
- Renvoie
- bool
Références value.
◆ testPrimality()
Tests Primality
- Paramètres
-
- Renvoie
- bool
Références value.
◆ toBits()
toBits |
( |
|
$twos_compliment = false | ) |
|
Converts a BigInteger to a bit string (eg. base-2).
Negative numbers are saved as positive numbers, unless $twos_compliment is set to true, at which point, they're saved as two's compliment.
- Paramètres
-
- Renvoie
- string
Références Engine\$hex, GMP\compare(), et Engine\toHex().
◆ toBytes()
toBytes |
( |
|
$twos_compliment = false | ) |
|
◆ toString()
◆ ENGINE_DIR
Engine Directory
- Voir également
- parent::setModExpEngine protected
◆ FAST_BITWISE
const FAST_BITWISE = true |
Can Bitwise operations be done fast?
- Voir également
- parent::bitwise_leftRotate()
-
parent::bitwise_rightRotate() protected
La documentation de cette classe a été générée à partir du fichier suivant :