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.

add(Integer $y)

Adds two BinaryFieldIntegers.

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

__construct($instanceID, $num = '')

Default constructor

Parameters

$instanceID
$num

static setModulo($instanceID, $modulo)

Set the modulo for a given instance

Parameters

$instanceID
$modulo

static setRecurringModuloFunction($instanceID, callable $function)

Set the modulo for a given instance

Parameters

$instanceID
callable $function

bool equals(Integer $x)

Tests the equality of two numbers.

Parameters

Integer $x

Return Value

bool

int compare(Integer $x)

Compares two numbers.

Parameters

Integer $x

Return Value

int

Integer add(Integer $y)

Adds two BinaryFieldIntegers.

Parameters

Integer $y

Return Value

Integer

Integer subtract(Integer $x)

Subtracts two BinaryFieldIntegers.

Parameters

Integer $x

Return Value

Integer

Integer multiply(Integer $y)

Multiplies two BinaryFieldIntegers.

Parameters

Integer $y

Return Value

Integer

Integer modInverse()

Returns the modular inverse of a BinaryFieldInteger

Return Value

Integer

Integer divide(Integer $x)

Divides two PrimeFieldIntegers.

Parameters

Integer $x

Return Value

Integer

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

Return Value

object

static int getModulo($instanceID)

Returns the modulo

Parameters

$instanceID

Return Value

int

string toBytes()

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

Return Value

string

string toHex()

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

Return Value

string

string toBits()

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

Return Value

string

string toBigInteger()

Converts an Integer to a BigInteger

Return Value

string

__toString()

__toString() magic method

__debugInfo()

__debugInfo() magic method