Integer
class Integer extends Integer (View source)
Prime Finite Fields
Properties
protected BigInteger | $value | Holds the PrimeField's value | |
protected int | $instanceID | Keeps track of current instance | |
static protected BigInteger | $modulo | Holds the PrimeField's modulo | |
static protected callable | $reduce | Holds a pre-generated function to perform modulo reductions | |
static protected BigInteger | $zero | Zero |
Methods
Set the modulo for a given instance
Returns the modulo
Calculates the square root
Is Odd?
Negate
Converts an Integer to a byte string (eg. base-256).
Converts an Integer to a hex string (eg. base-16).
Converts an Integer to a bit string (eg. base-2).
Returns the w-ary non-adjacent form (wNAF)
Converts an Integer to a BigInteger
__toString() magic method
__debugInfo() magic method
Details
__construct($instanceID, BigInteger $num = null)
Default constructor
static
setModulo($instanceID, BigInteger $modulo)
Set the modulo for a given instance
static
setRecurringModuloFunction($instanceID, callable $function)
Set the modulo for a given instance
static int
getModulo($instanceID)
Returns the modulo
static
checkInstance(Integer $x, Integer $y)
Tests a parameter to see if it's of the right instance
Throws an exception if the incorrect class is being utilized
bool
equals(Integer $x)
Tests the equality of two numbers.
int
compare(Integer $x)
Compares two numbers.
Integer
pow(BigInteger $x)
Performs power operation on a PrimeFieldInteger.
Integer|false
squareRoot()
Calculates the square root
bool
isOdd()
Is Odd?
object
negate()
Negate
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
string
toBytes()
Converts an Integer to a byte string (eg. base-256).
string
toHex()
Converts an Integer to a hex string (eg. base-16).
string
toBits()
Converts an Integer to a bit string (eg. base-2).
int[]
getNAF(int $w = 1)
Returns the w-ary non-adjacent form (wNAF)
string
toBigInteger()
Converts an Integer to a BigInteger
__toString()
__toString() magic method
__debugInfo()
__debugInfo() magic method