JanRain OpenID Library

Auth_OpenID_MathLibrary
in package

The superclass of all big-integer math implementations

Tags
access

private

Table of Contents

base64ToLong()  : mixed
binaryToLong()  : int
Given a binary string, returns the binary string converted to a long number.
cmp()  : int
longToBase64()  : mixed
longToBinary()  : string
Given a long integer, returns the number converted to a binary string. This function accepts long integer values of arbitrary magnitude and uses the local large-number math library when available.
rand()  : int
Returns a random number in the specified range. This function accepts $start, $stop, and $step values of arbitrary magnitude and will utilize the local large-number math library when available.
add()  : int
div()  : int
init()  : int
mod()  : int
mul()  : int
pow()  : int

Methods

base64ToLong()

public base64ToLong(mixed $str) : mixed
Parameters
$str : mixed
Return values
mixed

binaryToLong()

Given a binary string, returns the binary string converted to a long number.

public binaryToLong(string $str) : int
Parameters
$str : string

The binary version of a long number, probably as a result of calling longToBinary

Return values
int

$long The long number equivalent of the binary string $str

cmp()

public abstract cmp(int $x, int $y) : int
Parameters
$x : int
$y : int
Return values
int

longToBase64()

public longToBase64(mixed $str) : mixed
Parameters
$str : mixed
Return values
mixed

longToBinary()

Given a long integer, returns the number converted to a binary string. This function accepts long integer values of arbitrary magnitude and uses the local large-number math library when available.

public longToBinary(int $long) : string
Parameters
$long : int

The long number (can be a normal PHP integer or a number created by one of the available long number libraries)

Return values
string

$binary The binary version of $long

rand()

Returns a random number in the specified range. This function accepts $start, $stop, and $step values of arbitrary magnitude and will utilize the local large-number math library when available.

public rand(int $stop) : int
Parameters
$stop : int

The end of the range, or the maximum random number to return

Return values
int

$result The resulting randomly-generated number

add()

protected abstract add(int $x, int $y) : int
Parameters
$x : int
$y : int
Return values
int

div()

protected abstract div(int $x, int $y) : int
Parameters
$x : int
$y : int
Return values
int

init()

protected abstract init(int $number[, int $base = 10 ]) : int
Parameters
$number : int
$base : int = 10
Return values
int

mod()

protected abstract mod(int $base, int $modulus) : int
Parameters
$base : int
$modulus : int
Return values
int

mul()

protected abstract mul(int $x, int $y) : int
Parameters
$x : int
$y : int
Return values
int

pow()

protected abstract pow(int $base, int $exponent) : int
Parameters
$base : int
$exponent : int
Return values
int

Search results