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

__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

bool
equals(Integer \$x)

Tests the equality of two numbers.

int
compare(Integer \$x)

Compares two numbers.

subtract(Integer \$x)

Subtracts two PrimeFieldIntegers.

multiply(Integer \$x)

Multiplies two PrimeFieldIntegers.

divide(Integer \$x)

Divides two PrimeFieldIntegers.

pow(BigInteger \$x)

Performs power operation on a PrimeFieldInteger.

Integer|false
squareRoot()

Calculates the square root

bool
isOdd()

Is Odd?

object
negate()

Negate

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

Details

at line 68``` __construct(\$instanceID, BigInteger \$num = null) ```

Default constructor

Parameters

 \$instanceID BigInteger \$num

at line 82``` static setModulo(\$instanceID, BigInteger \$modulo) ```

Set the modulo for a given instance

Parameters

 \$instanceID BigInteger \$modulo

at line 90``` static setRecurringModuloFunction(\$instanceID, callable \$function) ```

Set the modulo for a given instance

Parameters

 \$instanceID callable \$function

at line 103``` static int getModulo(\$instanceID) ```

Returns the modulo

Parameters

 \$instanceID

 int

at line 113``` 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

Parameters

 Integer \$x Integer \$y

at line 125``` bool equals(Integer \$x) ```

Tests the equality of two numbers.

Parameters

 Integer \$x

 bool

at line 137``` int compare(Integer \$x) ```

Compares two numbers.

Parameters

 Integer \$x

 int

at line 149``` Integer add(Integer \$x) ```

Parameters

 Integer \$x

at line 167``` Integer subtract(Integer \$x) ```

Subtracts two PrimeFieldIntegers.

Parameters

 Integer \$x

at line 185``` Integer multiply(Integer \$x) ```

Multiplies two PrimeFieldIntegers.

Parameters

 Integer \$x

at line 197``` Integer divide(Integer \$x) ```

Divides two PrimeFieldIntegers.

Parameters

 Integer \$x

at line 210``` Integer pow(BigInteger \$x) ```

Performs power operation on a PrimeFieldInteger.

Parameters

 BigInteger \$x

at line 224``` Integer|false squareRoot() ```

Calculates the square root

Return Value

 Integer|false

Is Odd?

 bool

at line 287``` 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

 object

at line 297``` string toBytes() ```

Converts an Integer to a byte string (eg. base-256).

 string

at line 308``` string toHex() ```

Converts an Integer to a hex string (eg. base-16).

 string

at line 318``` string toBits() ```

Converts an Integer to a bit string (eg. base-2).

 string

at line 335``` int[] getNAF(int \$w = 1) ```

Returns the w-ary non-adjacent form (wNAF)

Parameters

 int \$w optional

 int[]

at line 375``` string toBigInteger() ```

Converts an Integer to a BigInteger

 string

at line 385``` __toString() ```

__toString() magic method

at line 395``` __debugInfo() ```

__debugInfo() magic method