Integer
extends Integer
in package
Prime Finite Fields
Tags
Table of Contents
Properties
- $instanceID : int
- Keeps track of current instance
- $modulo : BigInteger
- Holds the PrimeField's modulo
- $reduce : callable
- Holds a pre-generated function to perform modulo reductions
- $value : BigInteger
- Holds the PrimeField's value
- $zero : BigInteger
- Zero
Methods
- __construct() : mixed
- Default constructor
- __debugInfo() : mixed
- __debugInfo() magic method
- __toString() : mixed
- __toString() magic method
- add() : static
- Adds two PrimeFieldIntegers.
- checkInstance() : mixed
- Tests a parameter to see if it's of the right instance
- compare() : int
- Compares two numbers.
- divide() : static
- Divides two PrimeFieldIntegers.
- equals() : bool
- Tests the equality of two numbers.
- getModulo() : int
- Returns the modulo
- getNAF() : array<string|int, int>
- Returns the w-ary non-adjacent form (wNAF)
- isOdd() : bool
- Is Odd?
- multiply() : static
- Multiplies two PrimeFieldIntegers.
- negate() : object
- Negate
- pow() : static
- Performs power operation on a PrimeFieldInteger.
- setModulo() : mixed
- Set the modulo for a given instance
- setRecurringModuloFunction() : mixed
- Set the modulo for a given instance
- squareRoot() : static|false
- Calculates the square root
- subtract() : static
- Subtracts two PrimeFieldIntegers.
- toBigInteger() : string
- Converts an Integer to a BigInteger
- toBits() : string
- Converts an Integer to a bit string (eg. base-2).
- toBytes() : string
- Converts an Integer to a byte string (eg. base-256).
- toHex() : string
- Converts an Integer to a hex string (eg. base-16).
Properties
$instanceID
Keeps track of current instance
protected
int
$instanceID
$modulo
Holds the PrimeField's modulo
protected
static BigInteger
$modulo
$reduce
Holds a pre-generated function to perform modulo reductions
protected
static callable
$reduce
$value
Holds the PrimeField's value
protected
BigInteger
$value
$zero
Zero
protected
static BigInteger
$zero
Methods
__construct()
Default constructor
public
__construct(mixed $instanceID[, BigInteger $num = null ]) : mixed
Parameters
- $instanceID : mixed
- $num : BigInteger = null
__debugInfo()
__debugInfo() magic method
public
__debugInfo() : mixed
Tags
__toString()
__toString() magic method
public
__toString() : mixed
Tags
add()
Adds two PrimeFieldIntegers.
public
add(self $x) : static
Parameters
- $x : self
Return values
staticcheckInstance()
Tests a parameter to see if it's of the right instance
public
static checkInstance(self $x, self $y) : mixed
Throws an exception if the incorrect class is being utilized
Parameters
- $x : self
- $y : self
compare()
Compares two numbers.
public
compare(self $x) : int
Parameters
- $x : self
Return values
intdivide()
Divides two PrimeFieldIntegers.
public
divide(self $x) : static
Parameters
- $x : self
Return values
staticequals()
Tests the equality of two numbers.
public
equals(self $x) : bool
Parameters
- $x : self
Return values
boolgetModulo()
Returns the modulo
public
static getModulo(mixed $instanceID) : int
Parameters
- $instanceID : mixed
Return values
intgetNAF()
Returns the w-ary non-adjacent form (wNAF)
public
getNAF([int $w = 1 ]) : array<string|int, int>
Parameters
- $w : int = 1
-
optional
Return values
array<string|int, int>isOdd()
Is Odd?
public
isOdd() : bool
Return values
boolmultiply()
Multiplies two PrimeFieldIntegers.
public
multiply(self $x) : static
Parameters
- $x : self
Return values
staticnegate()
Negate
public
negate() : object
A negative number can be written as 0-12. With modulos, 0 is the same thing as the modulo so 0-12 is the same thing as modulo-12
Return values
objectpow()
Performs power operation on a PrimeFieldInteger.
public
pow(BigInteger $x) : static
Parameters
- $x : BigInteger
Return values
staticsetModulo()
Set the modulo for a given instance
public
static setModulo(mixed $instanceID, BigInteger $modulo) : mixed
Parameters
- $instanceID : mixed
- $modulo : BigInteger
setRecurringModuloFunction()
Set the modulo for a given instance
public
static setRecurringModuloFunction(mixed $instanceID, callable $function) : mixed
Parameters
- $instanceID : mixed
- $function : callable
squareRoot()
Calculates the square root
public
squareRoot() : static|false
Tags
Return values
static|falsesubtract()
Subtracts two PrimeFieldIntegers.
public
subtract(self $x) : static
Parameters
- $x : self
Return values
statictoBigInteger()
Converts an Integer to a BigInteger
public
toBigInteger() : string
Return values
stringtoBits()
Converts an Integer to a bit string (eg. base-2).
public
toBits() : string
Return values
stringtoBytes()
Converts an Integer to a byte string (eg. base-256).
public
toBytes() : string
Return values
stringtoHex()
Converts an Integer to a hex string (eg. base-16).
public
toHex() : string