PHP Class Jose\Util\BigInteger

Datei anzeigen Open project: spomky-labs/jose Class Usage Examples

Public Methods

Method Description
add ( BigInteger $y ) : BigInteger Adds two BigIntegers.
compare ( BigInteger $y ) : integer Compares two numbers.
createFromBinaryString ( string $value ) : BigInteger
createFromDecimal ( integer $value ) : BigInteger
createFromDecimalString ( string $value ) : BigInteger
createFromGMPResource ( resource $value ) : BigInteger
mod ( BigInteger $d ) : BigInteger Performs modular exponentiation.
modInverse ( BigInteger $n ) : BigInteger Calculates modular inverses.
modPow ( BigInteger $e, BigInteger $n ) : BigInteger Performs modular exponentiation.
multiply ( BigInteger $x ) : BigInteger Multiplies two BigIntegers.
subtract ( BigInteger $y ) : BigInteger Subtracts two BigIntegers.
toBytes ( ) : string Converts a BigInteger to a binary string.

Private Methods

Method Description
__construct ( GMP | string $value, integer $base ) Converts base-10 and binary strings (base-256) to BigIntegers.

Method Details

add() public method

@param \Jose\Util\BigInteger $y
public add ( BigInteger $y ) : BigInteger
$y BigInteger
return BigInteger

compare() public method

Compares two numbers.
public compare ( BigInteger $y ) : integer
$y BigInteger
return integer < 0 if $this is less than $y; > 0 if $this is greater than $y, and 0 if they are equal.

createFromBinaryString() public static method

public static createFromBinaryString ( string $value ) : BigInteger
$value string
return BigInteger

createFromDecimal() public static method

public static createFromDecimal ( integer $value ) : BigInteger
$value integer
return BigInteger

createFromDecimalString() public static method

public static createFromDecimalString ( string $value ) : BigInteger
$value string
return BigInteger

createFromGMPResource() public static method

public static createFromGMPResource ( resource $value ) : BigInteger
$value resource
return BigInteger

mod() public method

Performs modular exponentiation.
public mod ( BigInteger $d ) : BigInteger
$d BigInteger
return BigInteger

modInverse() public method

Calculates modular inverses.
public modInverse ( BigInteger $n ) : BigInteger
$n BigInteger
return BigInteger

modPow() public method

Performs modular exponentiation.
public modPow ( BigInteger $e, BigInteger $n ) : BigInteger
$e BigInteger
$n BigInteger
return BigInteger

multiply() public method

Multiplies two BigIntegers.
public multiply ( BigInteger $x ) : BigInteger
$x BigInteger @return \Jose\Util\BigInteger
return BigInteger

subtract() public method

@param \Jose\Util\BigInteger $y
public subtract ( BigInteger $y ) : BigInteger
$y BigInteger
return BigInteger

toBytes() public method

Converts a BigInteger to a binary string.
public toBytes ( ) : string
return string