Documentation

Integer extends Integer
in package

Prime Finite Fields

Tags
author

Jim Wigginton terrafrost@php.net

access

public

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

$reduce

Holds a pre-generated function to perform modulo reductions

protected static callable $reduce

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
access

public

__toString()

__toString() magic method

public __toString() : mixed
Tags
access

public

add()

Adds two PrimeFieldIntegers.

public add(self $x) : static
Parameters
$x : self
Return values
static

checkInstance()

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
int

divide()

Divides two PrimeFieldIntegers.

public divide(self $x) : static
Parameters
$x : self
Return values
static

equals()

Tests the equality of two numbers.

public equals(self $x) : bool
Parameters
$x : self
Return values
bool

getModulo()

Returns the modulo

public static getModulo(mixed $instanceID) : int
Parameters
$instanceID : mixed
Return values
int

getNAF()

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
bool

multiply()

Multiplies two PrimeFieldIntegers.

public multiply(self $x) : static
Parameters
$x : self
Return values
static

negate()

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
object

pow()

Performs power operation on a PrimeFieldInteger.

public pow(BigInteger $x) : static
Parameters
$x : BigInteger
Return values
static

setModulo()

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

subtract()

Subtracts two PrimeFieldIntegers.

public subtract(self $x) : static
Parameters
$x : self
Return values
static

toBigInteger()

Converts an Integer to a BigInteger

public toBigInteger() : string
Return values
string

toBits()

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

public toBits() : string
Return values
string

toBytes()

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

public toBytes() : string
Return values
string

toHex()

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

public toHex() : string
Return values
string

        
On this page

Search results