Joomla CMS
4.2.2
Documentation des API du CMS Joomla en version 4.2.2
|
Fonctions membres publiques statiques | |
static | isValidEngine () |
Fonctions membres publiques statiques hérités de PHP | |
static | subtractHelper (array $x_value, $x_negative, array $y_value, $y_negative) |
static | scan1divide (PHP $r) |
Fonctions membres publiques statiques hérités de Engine | |
static | setModExpEngine ($engine) |
static | minMaxBits ($bits) |
Champs de données | |
const | VARIABLE = 0 |
const | DATA = 1 |
Champs de données hérités de PHP | |
const | VALUE = 0 |
const | SIGN = 1 |
const | KARATSUBA_CUTOFF = 25 |
const | FAST_BITWISE = true |
const | ENGINE_DIR = 'PHP' |
Champs de données hérités de Engine | |
const | PRIMES |
Fonctions membres protégées statiques | |
static | powModHelper (PHP $x, PHP $e, PHP $n, $class) |
static | prepareReduce (array $x, array $n, $class) |
static | multiplyReduce (array $x, array $y, array $n, $class) |
static | squareReduce (array $x, array $n, $class) |
Fonctions membres protégées statiques hérités de PHP | |
static | addHelper (array $x_value, $x_negative, array $y_value, $y_negative) |
static | multiplyHelper (array $x_value, $x_negative, array $y_value, $y_negative) |
static | regularMultiply (array $x_value, array $y_value) |
static | compareHelper (array $x_value, $x_negative, array $y_value, $y_negative) |
static | trim (array $value) |
static | array_repeat ($input, $multiplier) |
static | square (array $x) |
static | baseSquare (array $value) |
static | karatsubaSquare (array $value) |
Fonctions membres protégées statiques hérités de Engine | |
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) |
|
static |
|
staticprotected |
Performs modular exponentiation.
The most naive approach to modular exponentiation has very unreasonable requirements, and and although the approach involving repeated squaring does vastly better, it, too, is impractical for our purposes. The reason being that division - by far the most complicated and time-consuming of the basic operations (eg. +,-,*,/) - occurs multiple times within it.
Modular reductions resolve this issue. Although an individual modular reduction takes more time then an individual division, when performed in succession (with the same modulo), they're a lot faster.
The two most commonly used modular reductions are Barrett and Montgomery reduction. Montgomery reduction, although faster, only works when the gcd of the modulo and of the base being used is 1. In RSA, when the base is a power of two, the modulo - a product of two primes - is always going to have a gcd of 1 (because the product of two odd numbers is odd), but what about when RSA isn't used?
In contrast, Barrett reduction has no such constraint. As such, some bigint implementations perform a Barrett reduction after every operation in the modpow function. Others perform Barrett reductions when the modulo is even and Montgomery reductions when the modulo is odd. BigInteger.java's modPow method, however, uses a trick involving the Chinese Remainder Theorem to factor the even modulo into two numbers - one odd and the other, a power of two - and recombine them, later. This is the method that this modPow function uses. Montgomery Reduction with Even Modulus elaborates.
Références $class, $n, $temp, et PHP\normalize().
Référencé par PHP\powModInner().
|
staticprotected |
|
staticprotected |
const DATA = 1 |
$cache[self::DATA] contains the cached data.
private
const VARIABLE = 0 |
Cache constants
$cache[self::VARIABLE] tells us whether or not the cached data is still valid.
private