class Integer extends Integer (View source)

Binary Finite Fields

## Properties

 protected string \$value Holds the BinaryField's value protected int \$instanceID Keeps track of current instance static protected string[] \$modulo Holds the PrimeField's modulo static protected callable[] \$reduce Holds a pre-generated function to perform modulo reductions

## Methods

__construct(\$instanceID, \$num = '')

Default constructor

static
setModulo(\$instanceID, \$modulo)

Set the modulo for a given instance

static
setRecurringModuloFunction(\$instanceID, callable \$function)

Set the modulo for a given instance

bool
equals(Integer \$x)

Tests the equality of two numbers.

int
compare(Integer \$x)

Compares two numbers.

subtract(Integer \$x)

Subtracts two BinaryFieldIntegers.

multiply(Integer \$y)

Multiplies two BinaryFieldIntegers.

modInverse()

Returns the modular inverse of a BinaryFieldInteger

divide(Integer \$x)

Divides two PrimeFieldIntegers.

object
negate()

Negate

static int
getModulo(\$instanceID)

Returns the modulo

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).

string
toBigInteger()

Converts an Integer to a BigInteger

__toString()

__toString() magic method

__debugInfo()

__debugInfo() magic method

## Details

### at line 70``` __construct(\$instanceID, \$num = '') ```

Default constructor

#### Parameters

 \$instanceID \$num

### at line 84``` static setModulo(\$instanceID, \$modulo) ```

Set the modulo for a given instance

#### Parameters

 \$instanceID \$modulo

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

Set the modulo for a given instance

#### Parameters

 \$instanceID callable \$function

### at line 114``` bool equals(Integer \$x) ```

Tests the equality of two numbers.

#### Parameters

 Integer \$x

 bool

### at line 126``` int compare(Integer \$x) ```

Compares two numbers.

#### Parameters

 Integer \$x

 int

### at line 353``` Integer add(Integer \$y) ```

#### Parameters

 Integer \$y

### at line 370``` Integer subtract(Integer \$x) ```

Subtracts two BinaryFieldIntegers.

#### Parameters

 Integer \$x

### at line 380``` Integer multiply(Integer \$y) ```

Multiplies two BinaryFieldIntegers.

#### Parameters

 Integer \$y

### at line 392``` Integer modInverse() ```

Returns the modular inverse of a BinaryFieldInteger

### at line 427``` Integer divide(Integer \$x) ```

Divides two PrimeFieldIntegers.

#### Parameters

 Integer \$x

### at line 443``` 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 455``` static int getModulo(\$instanceID) ```

Returns the modulo

#### Parameters

 \$instanceID

 int

### at line 465``` string toBytes() ```

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

 string

### at line 475``` string toHex() ```

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

 string

### at line 485``` string toBits() ```

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

 string

### at line 496``` string toBigInteger() ```

Converts an Integer to a BigInteger

 string

### at line 506``` __toString() ```

__toString() magic method

### at line 516``` __debugInfo() ```

__debugInfo() magic method