Joomla CMS
4.2.2
Documentation des API du CMS Joomla en version 4.2.2
|
Fonctions membres publiques | |
__construct ($x=0, $base=10) | |
toString () | |
__toString () | |
__debugInfo () | |
toBytes ($twos_compliment=false) | |
toHex ($twos_compliment=false) | |
toBits ($twos_compliment=false) | |
add (BigInteger $y) | |
subtract (BigInteger $y) | |
multiply (BigInteger $x) | |
divide (BigInteger $y) | |
modInverse (BigInteger $n) | |
gcd (BigInteger $n) | |
abs () | |
setPrecision ($bits) | |
getPrecision () | |
__sleep () | |
__wakeup () | |
jsonSerialize () | |
powMod (BigInteger $e, BigInteger $n) | |
modPow (BigInteger $e, BigInteger $n) | |
compare (BigInteger $y) | |
equals (BigInteger $x) | |
bitwise_not () | |
bitwise_and (BigInteger $x) | |
bitwise_or (BigInteger $x) | |
bitwise_xor (BigInteger $x) | |
bitwise_rightShift ($shift) | |
bitwise_leftShift ($shift) | |
bitwise_leftRotate ($shift) | |
bitwise_rightRotate ($shift) | |
getLength () | |
getLengthInBytes () | |
isPrime ($t=false) | |
root ($n=2) | |
pow (BigInteger $n) | |
between (BigInteger $min, BigInteger $max) | |
__clone () | |
isOdd () | |
testBit ($x) | |
isNegative () | |
negate () | |
createRecurringModuloFunction () | |
bitwise_split ($split) | |
Fonctions membres publiques statiques | |
static | getEngine () |
static | random ($size) |
static | randomPrime ($size) |
static | randomRangePrime (BigInteger $min, BigInteger $max) |
static | randomRange (BigInteger $min, BigInteger $max) |
static | min (BigInteger ... $nums) |
static | max (BigInteger ... $nums) |
static | scan1divide (BigInteger $r) |
Fonctions membres privées statiques | |
static | initialize_static_variables () |
Attributs privés | |
$value | |
$hex | |
$precision | |
Attributs privés statiques | |
static | $mainEngine |
static | $engines |
__construct | ( | $x = 0 , |
|
$base = 10 |
|||
) |
Converts base-2, base-10, base-16, and binary strings (base-256) to BigIntegers.
If the second parameter - $base - is negative, then it will be assumed that the number's are encoded using two's compliment. The sole exception to this is -10, which is treated the same as 10 is.
string | int | BigInteger\Engines\Engine | $x | Base-10 number or base-$base number if $base set. |
int | $base |
Références $base, elseif, phpseclib3\Crypt\EC\Formats\Keys\initialize_static_variables(), et value.
__clone | ( | ) |
Clone
Références BigInteger\$value, et value.
__debugInfo | ( | ) |
__debugInfo() magic method
Will be called, automatically, when print_r() or var_dump() are called
Références value.
__sleep | ( | ) |
Serialize
Will be called, automatically, when serialize() is called on a BigInteger object.
__sleep() / __wakeup() have been around since PHP 4.0
was introduced in PHP 5.1 and deprecated in PHP 8.1: https://wiki.php.net/rfc/phase_out_serializable
__serialize() / __unserialize() were introduced in PHP 7.4: https://wiki.php.net/rfc/custom_object_serialization
Références BigInteger\getPrecision(), et BigInteger\toHex().
__toString | ( | ) |
__toString() magic method
Références BigInteger\$value.
__wakeup | ( | ) |
Serialize
Will be called, automatically, when unserialize() is called on a BigInteger object.
Références BigInteger\$hex, $temp, BigInteger\setPrecision(), et value.
abs | ( | ) |
add | ( | BigInteger | $y | ) |
Adds two BigIntegers.
BigInteger | $y |
Références value.
Référencé par Engine\__construct(), et Engine\toBytesHelper().
between | ( | BigInteger | $min, |
BigInteger | $max | ||
) |
Tests BigInteger to see if it is between two integers, inclusive
BigInteger | $min | |
BigInteger | $max |
Références value.
bitwise_and | ( | BigInteger | $x | ) |
bitwise_leftRotate | ( | $shift | ) |
Logical Left Rotate
Instead of the top x bits being dropped they're appended to the shifted bit string.
int | $shift |
Références value.
bitwise_leftShift | ( | $shift | ) |
Logical Left Shift
Shifts BigInteger's by $shift bits, effectively multiplying by 2**$shift.
int | $shift |
Références value.
Référencé par Engine\bitwise_leftRotate().
bitwise_not | ( | ) |
bitwise_or | ( | BigInteger | $x | ) |
bitwise_rightRotate | ( | $shift | ) |
Logical Right Rotate
Instead of the bottom x bits being dropped they're prepended to the shifted bit string.
int | $shift |
Références value.
bitwise_rightShift | ( | $shift | ) |
Logical Right Shift
Shifts BigInteger's by $shift bits, effectively dividing by 2**$shift.
int | $shift |
Références value.
Référencé par Engine\bitwise_leftRotate(), et KoblitzPrime\extendedGCD().
bitwise_split | ( | $split | ) |
Bitwise Split
Splits BigInteger's into chunks of $split bits
int | $split |
bitwise_xor | ( | BigInteger | $x | ) |
compare | ( | BigInteger | $y | ) |
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 >
x->compare($y) > 0 $x <
x->compare($y) < 0 $x ==
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 value.
Référencé par KoblitzPrime\extendedGCD(), Engine\rootHelper(), Engine\toBits(), et Engine\toBytesHelper().
createRecurringModuloFunction | ( | ) |
Create Recurring Modulo Function
Sometimes it may be desirable to do repeated modulos with the same number outside of modular exponentiation
Références value.
Référencé par PrimeField\__construct().
divide | ( | BigInteger | $y | ) |
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).
Here's an example: <?php $a = new ('10'); $b = new ('20');
list($quotient, $remainder) = $a->divide($b);
echo $quotient->toString(); // outputs 0 echo "\r\n"; echo $remainder->toString(); // outputs 10 ?>
BigInteger | $y |
Référencé par KoblitzPrime\extendedGCD().
equals | ( | BigInteger | $x | ) |
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()
BigInteger | $x |
Références value.
Référencé par KoblitzPrime\extendedGCD().
gcd | ( | BigInteger | $n | ) |
Calculates the greatest common divisor
Say you have 693 and 609. The GCD is 21.
BigInteger | $n |
Références value.
|
static |
Returns the engine type
Références phpseclib3\Crypt\EC\Formats\Keys\initialize_static_variables().
getLength | ( | ) |
Return the size of a BigInteger in bits
Références value.
Référencé par KoblitzPrime\extendedGCD(), et SSH2\save().
getLengthInBytes | ( | ) |
getPrecision | ( | ) |
Get Precision
Returns the precision if it exists, false if it doesn't
Références value.
Référencé par BigInteger\__sleep(), et BigInteger\jsonSerialize().
|
staticprivate |
Initialize static variables
Références BigInteger\$engines.
isNegative | ( | ) |
isOdd | ( | ) |
isPrime | ( | $t = false | ) |
Checks a numer to see if it's prime
Assuming the $t parameter is not set, this function has an error rate of 2**-80. The main motivation for the $t parameter is distributability. BigInteger::randomPrime() can be distributed across multiple pageloads on a website instead of just one.
int | bool | $t |
Références value.
jsonSerialize | ( | ) |
JSON Serialize
Will be called, automatically, when json_encode() is called on a BigInteger object.
Références $result, BigInteger\getPrecision(), et BigInteger\toHex().
|
static |
Return the maximum BigInteger between an arbitrary number of BigIntegers.
BigInteger | ...$nums |
Références $class.
Référencé par Engine\bitwiseAndHelper(), Engine\bitwiseOrHelper(), Engine\bitwiseXorHelper(), PHP\compareHelper(), et MontgomeryMult\multiplyReduce().
|
static |
Return the minimum BigInteger between an arbitrary number of BigIntegers.
BigInteger | ...$nums |
Références $class.
Référencé par PHP\karatsuba(), PHP\multiplyHelper(), et PHP\normalize().
modInverse | ( | BigInteger | $n | ) |
Calculates modular inverses.
Say you have (30 mod 17 * x mod 17) mod 17 == 1. x can be found using modular inverses.
BigInteger | $n |
Références value.
Référencé par Engine\powModOuter().
modPow | ( | BigInteger | $e, |
BigInteger | $n | ||
) |
Performs modular exponentiation.
BigInteger | $e | |
BigInteger | $n |
Référencé par PublicKey\exponentiate(), et PrivateKey\exponentiate().
multiply | ( | BigInteger | $x | ) |
Multiplies two BigIntegers
BigInteger | $x |
Références value.
Référencé par KoblitzPrime\extendedGCD(), Ed448\recoverX(), et Ed25519\recoverX().
negate | ( | ) |
pow | ( | BigInteger | $n | ) |
powMod | ( | BigInteger | $e, |
BigInteger | $n | ||
) |
|
static |
Generates a random number of a certain size
Bit length is equal to $size
int | $size |
Références $class, $size, et phpseclib3\Crypt\EC\Formats\Keys\initialize_static_variables().
Référencé par DSA\createParameters(), Curve25519\createRandomMultiplier(), et Curve448\createRandomMultiplier().
|
static |
Generates a random prime number of a certain size
Bit length is equal to $size
int | $size |
Références $class, $size, et phpseclib3\Crypt\EC\Formats\Keys\initialize_static_variables().
Référencé par DH\createParameters(), et DSA\createParameters().
|
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)
BigInteger | $min | |
BigInteger | $max |
Références $class.
Référencé par DSA\createKey(), DH\createKey(), Base\createRandomMultiplier(), PrivateKey\exponentiate(), PrimeField\randomInteger(), BinaryField\randomInteger(), et PrivateKey\sign().
|
static |
Generate a random prime number between a range
If there's not a prime within the given range, false will be returned.
BigInteger | $min | |
BigInteger | $max |
Références $class.
root | ( | $n = 2 | ) |
Calculates the nth root of a biginteger.
Returns the nth root of a positive biginteger, where n defaults to 2
int | $n | optional |
Références value.
|
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));
BigInteger | $r |
Référencé par Integer\squareRoot().
setPrecision | ( | $bits | ) |
Set Precision
Some bitwise operations give different results depending on the precision being used. Examples include left shift, not, and rotates.
int | $bits |
Références value.
Référencé par BigInteger\__wakeup().
subtract | ( | BigInteger | $y | ) |
testBit | ( | $x | ) |
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.
bool | $twos_compliment |
Références value.
Référencé par Base\multiplyPoint(), Montgomery\multiplyPoint(), et PuTTY\savePrivateKey().
toBytes | ( | $twos_compliment = false | ) |
Converts a BigInteger to a byte string (eg. base-256).
bool | $twos_compliment |
Références value.
Référencé par Engine\bitwise_leftRotate(), Engine\bitwise_not(), Engine\bitwiseAndHelper(), Engine\bitwiseOrHelper(), Engine\bitwiseXorHelper(), Engine\getLengthInBytes(), Curve25519\multiplyPoint(), Curve448\multiplyPoint(), SSH2\save(), MontgomeryPrivate\savePrivateKey(), PuTTY\savePrivateKey(), XML\savePrivateKey(), PKCS1\savePrivateKey(), MSBLOB\savePrivateKey(), PKCS8\savePrivateKey(), XML\savePublicKey(), Engine\toBits(), et Engine\toHex().
toHex | ( | $twos_compliment = false | ) |
Converts a BigInteger to a hex string (eg. base-16).
bool | $twos_compliment |
Références value.
Référencé par BigInteger\__sleep(), et BigInteger\jsonSerialize().
toString | ( | ) |
Converts a BigInteger to a base-10 number.
Références value.
Référencé par Engine\__toString().
|
staticprivate |
Référencé par BigInteger\initialize_static_variables().
|
private |
Référencé par BigInteger\__wakeup().
|
staticprivate |
|
private |
|
private |
Référencé par BigInteger\__clone(), et BigInteger\__toString().