[ Index ] |
PHP Cross Reference of DokuWiki |
[Source view] [Print] [Project Stats]
Prime Finite Fields PHP version 5 and 7
Author: | Jim Wigginton |
Copyright: | 2017 Jim Wigginton |
License: | http://www.opensource.org/licenses/mit-license.html MIT License |
File Size: | 419 lines (10 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
Integer:: (23 methods):
__construct()
setModulo()
setRecurringModuloFunction()
cleanupCache()
getModulo()
checkInstance()
equals()
compare()
add()
subtract()
multiply()
divide()
pow()
squareRoot()
isOdd()
negate()
toBytes()
toHex()
toBits()
getNAF()
toBigInteger()
__toString()
__debugInfo()
__construct($instanceID, BigInteger $num = null) X-Ref |
Default constructor param: int $instanceID |
setModulo($instanceID, BigInteger $modulo) X-Ref |
Set the modulo for a given instance return: void param: int $instanceID |
setRecurringModuloFunction($instanceID, callable $function) X-Ref |
Set the modulo for a given instance return: void param: int $instanceID |
cleanupCache($instanceID) X-Ref |
Delete the modulo for a given instance |
getModulo($instanceID) X-Ref |
Returns the modulo return: BigInteger param: int $instanceID |
checkInstance(self $x, self $y) X-Ref |
Tests a parameter to see if it's of the right instance Throws an exception if the incorrect class is being utilized return: void |
equals(self $x) X-Ref |
Tests the equality of two numbers. return: bool |
compare(self $x) X-Ref |
Compares two numbers. return: int |
add(self $x) X-Ref |
Adds two PrimeFieldIntegers. return: static |
subtract(self $x) X-Ref |
Subtracts two PrimeFieldIntegers. return: static |
multiply(self $x) X-Ref |
Multiplies two PrimeFieldIntegers. return: static |
divide(self $x) X-Ref |
Divides two PrimeFieldIntegers. return: static |
pow(BigInteger $x) X-Ref |
Performs power operation on a PrimeFieldInteger. return: static |
squareRoot() X-Ref |
Calculates the square root return: static|false link: https://en.wikipedia.org/wiki/Tonelli%E2%80%93Shanks_algorithm |
isOdd() X-Ref |
Is Odd? return: bool |
negate() X-Ref |
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: static |
toBytes() X-Ref |
Converts an Integer to a byte string (eg. base-256). return: string |
toHex() X-Ref |
Converts an Integer to a hex string (eg. base-16). return: string |
toBits() X-Ref |
Converts an Integer to a bit string (eg. base-2). return: string |
getNAF($w = 1) X-Ref |
Returns the w-ary non-adjacent form (wNAF) return: array<int, int> param: int $w optional |
toBigInteger() X-Ref |
Converts an Integer to a BigInteger return: BigInteger |
__toString() X-Ref |
__toString() magic method return: string |
__debugInfo() X-Ref |
__debugInfo() magic method return: array |