[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/ -> PHP64.php (summary)

Pure-PHP 64-bit BigInteger Engine PHP version 5 and 7

Author: Jim Wigginton <[email protected]>
Copyright: 2017 Jim Wigginton
License: http://www.opensource.org/licenses/mit-license.html MIT License
File Size: 377 lines (9 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

PHP64:: (22 methods):
  initialize()
  isValidEngine()
  add()
  subtract()
  multiply()
  divide()
  modInverse()
  extendedGCD()
  gcd()
  bitwise_and()
  bitwise_or()
  bitwise_xor()
  compare()
  equals()
  modPow()
  powMod()
  randomRangePrime()
  randomRange()
  pow()
  min()
  max()
  between()


Class: PHP64  - X-Ref

Pure-PHP 64-bit Engine.

Uses 64-bit integers if int size is 8 bits

initialize($base)   X-Ref
Initialize a PHP64 BigInteger Engine instance

param: int $base

isValidEngine()   X-Ref
Test for engine validity

return: bool

add(PHP64 $y)   X-Ref
Adds two BigIntegers.

param: PHP64 $y
return: PHP64

subtract(PHP64 $y)   X-Ref
Subtracts two BigIntegers.

param: PHP64 $y
return: PHP64

multiply(PHP64 $y)   X-Ref
Multiplies two BigIntegers.

param: PHP64 $y
return: PHP64

divide(PHP64 $y)   X-Ref
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: PHP64 $y
return: array{PHP64, PHP64}

modInverse(PHP64 $n)   X-Ref
Calculates modular inverses.

Say you have (30 mod 17 * x mod 17) mod 17 == 1.  x can be found using modular inverses.
param: PHP64 $n
return: false|PHP64

extendedGCD(PHP64 $n)   X-Ref
Calculates modular inverses.

Say you have (30 mod 17 * x mod 17) mod 17 == 1.  x can be found using modular inverses.
param: PHP64 $n
return: PHP64[]

gcd(PHP64 $n)   X-Ref
Calculates the greatest common divisor

Say you have 693 and 609.  The GCD is 21.

param: PHP64 $n
return: PHP64

bitwise_and(PHP64 $x)   X-Ref
Logical And

param: PHP64 $x
return: PHP64

bitwise_or(PHP64 $x)   X-Ref
Logical Or

param: PHP64 $x
return: PHP64

bitwise_xor(PHP64 $x)   X-Ref
Logical Exclusive Or

param: PHP64 $x
return: PHP64

compare(PHP64 $y)   X-Ref
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).

{@internal Could return $this->subtract($x), but that's not as fast as what we do do.}

param: PHP64 $y
return: int in case < 0 if $this is less than $y; > 0 if $this is greater than $y, and 0 if they are equal.

equals(PHP64 $x)   X-Ref
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: PHP64 $x
return: bool

modPow(PHP64 $e, PHP64 $n)   X-Ref
Performs modular exponentiation.

param: PHP64 $e
param: PHP64 $n
return: PHP64

powMod(PHP64 $e, PHP64 $n)   X-Ref
Performs modular exponentiation.

Alias for modPow().

param: PHP64 $e
param: PHP64 $n
return: PHP64|false

randomRangePrime(PHP64 $min, PHP64 $max)   X-Ref
Generate a random prime number between a range

If there's not a prime within the given range, false will be returned.

param: PHP64 $min
param: PHP64 $max
return: false|PHP64

randomRange(PHP64 $min, PHP64 $max)   X-Ref
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: PHP64 $min
param: PHP64 $max
return: PHP64

pow(PHP64 $n)   X-Ref
Performs exponentiation.

param: PHP64 $n
return: PHP64

min(PHP64 ...$nums)   X-Ref
Return the minimum BigInteger between an arbitrary number of BigIntegers.

param: PHP64 ...$nums
return: PHP64

max(PHP64 ...$nums)   X-Ref
Return the maximum BigInteger between an arbitrary number of BigIntegers.

param: PHP64 ...$nums
return: PHP64

between(PHP64 $min, PHP64 $max)   X-Ref
Tests BigInteger to see if it is between two integers, inclusive

param: PHP64 $min
param: PHP64 $max
return: bool



Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer