Integer

Extends\phpseclib3\Math\Common\FiniteField\Integer

Prime Finite Fields

author

Jim Wigginton terrafrost@php.net

package

Default

Methods

Default constructor

__construct(integer $instanceID,\phpseclib3\Math\BigInteger $num = null)

Arguments

$instanceID

integer

__debugInfo() magic method

__debugInfo(): array

Response

array

__toString() magic method

__toString(): string

Response

string

Adds two PrimeFieldIntegers.

add(self $x): static

Arguments

$x

self

Response

static

Tests a parameter to see if it's of the right instance

checkInstance(self $x,self $y): void
static

Throws an exception if the incorrect class is being utilized

Arguments

$x

self

$y

self

Delete the modulo for a given instance

cleanupCache( $instanceID)
static

Arguments

$instanceID

Compares two numbers.

compare(self $x): integer

Arguments

$x

self

Response

integer

Divides two PrimeFieldIntegers.

divide(self $x): static

Arguments

$x

self

Response

static

Tests the equality of two numbers.

equals(self $x): boolean

Arguments

$x

self

Response

boolean

Returns the modulo

getModulo(integer $instanceID): \phpseclib3\Math\BigInteger
static

Arguments

$instanceID

integer

Response

\phpseclib3\Math\BigInteger

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

getNAF(integer $w = 1): \phpseclib3\Math\PrimeField\array<int,

Arguments

$w

integer

optional

Response

\phpseclib3\Math\PrimeField\array

int>

Is Odd?

isOdd(): boolean

Response

boolean

jsonSerialize

jsonSerialize()

Multiplies two PrimeFieldIntegers.

multiply(self $x): static

Arguments

$x

self

Response

static

Negate

negate(): static

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

Response

static

Performs power operation on a PrimeFieldInteger.

pow(\phpseclib3\Math\BigInteger $x): static

Arguments

Response

static

Set the modulo for a given instance

setModulo(integer $instanceID,\phpseclib3\Math\BigInteger $modulo): void
static

Arguments

$instanceID

integer

Set the modulo for a given instance

setRecurringModuloFunction(integer $instanceID,callable $function): void
static

Arguments

$instanceID

integer

$function

callable

Calculates the square root

squareRoot(): static|false

Subtracts two PrimeFieldIntegers.

subtract(self $x): static

Arguments

$x

self

Response

static

Converts an Integer to a BigInteger

toBigInteger(): \phpseclib3\Math\BigInteger

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

toBits(): string

Response

string

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

toBytes(): string

Response

string

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

toHex(): string
abstract

Response

string

Properties

Holds the PrimeField's value

value :\phpseclib3\Math\BigInteger

Keeps track of current instance

instanceID :integer
var

Type(s)

integer

Holds the PrimeField's modulo

modulo :\phpseclib3\Math\PrimeField\array<int,
static
var

BigInteger>

Type(s)

\phpseclib3\Math\PrimeField\array

Holds a pre-generated function to perform modulo reductions

reduce :\phpseclib3\Math\PrimeField\array<int,
static
var

callable(BigInteger):BigInteger>

Type(s)

\phpseclib3\Math\PrimeField\array

Zero

zero :\phpseclib3\Math\BigInteger
static