| Modifier and Type | Field and Description |
|---|---|
| private static final BigInteger | |
| private static final int[] | |
| private static final BigInteger | |
| private static final long | |
| private static final int[] | |
| private static SecureRandom | |
| private static final BigInteger | |
| private static final BigInteger |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static BigInteger | Returns: the binomialcoefficient "n over t" as BigInteger- the "upper" integer n, int - the "lower" integer t)Computes the binomial coefficient (n|t) ("n over t"). |
| public static int | |
| public static int | Returns: ceil[log(a)]the integer a)Compute the smallest integer that is greater than or equal to the logarithm to the base 2 of the given BigInteger. |
| public static int | Returns: ceil[log(a)]the integer a)Compute the smallest integer that is greater than or equal to the logarithm to the base 2 of the given integer. |
| public static int | Returns: the number of bytes needed to encode nthe integer n)Compute ceil(log_256 n), the number of bytes needed to encode the integer n. |
| public static int | Returns: the number of bytes needed to encode nthe long integer n)Compute ceil(log_256 n), the number of bytes needed to encode the long integer n. |
| public static BigInteger | |
| public static BigInteger[] | |
| public static int[] | Returns: (g,u,v), where g = gcd(abs(a),abs(b)) = ua + vbthe first integer a, int the second integer b)Extended euclidian algorithm (computes gcd and representation). |
| public static BigInteger[] | Returns: (d,u,v), where d = gcd(a,b) = ua + vb- the first integer a, BigInteger - the second integer b)Extended euclidian algorithm (computes gcd and representation). |
| public static float | Returns: int power i of fbase float f, int power to be raised to. i)int power of a base float, only use for small ints |
| public static int | Returns: floor[log(a)]the integer a)Compute the integer part of the logarithm to the base 2 of the given integer. |
| public static int | Returns: floor[log(a)]the integer a)Compute the integer part of the logarithm to the base 2 of the given integer. |
| public static int | Returns: gcd(a, b)- first integer u, int - second integer v)Computes the greatest common divisor of the two specified integers |
| public static byte[] | |
| public static float | intRoot(int
the base to take the root from base, int the root, for example 2 for a square root root)Takes an approximation of the root from an integer base, using newton's algorithm |
| public static boolean | |
| public static int | Returns: n if a = p^n or -1 otherwise- the first integer a, int - the second integer p)Tests whether an integer a is power of another integer p. |
| public static boolean | Returns: true if the given integer is prime with probability 2-100, false otherwisethe integer to test for primality n)Miller-Rabin-Test, determines wether the given integer is probably prime or composite. |
| public static int | Returns: value of the jacobi symbol (A|B)integer value A, BigInteger integer value B)Computes the value of the Jacobi symbol (A|B). |
| public static BigInteger | Returns: the lcm(numbers)- the set of numbers numbers)Computation of the least common multiple of a set of BigIntegers. |
| public static int | Returns: divisor p >1 or 1 if a = -1,0,1- the integer a)Find and return the least non-trivial divisor of an integer a. |
| public static double | Returns: log_2(x)any double value x)
Deprecated
use MathFunctions.log(double) instead
calculate the logarithm to the base 2.
|
| public static double | Returns: log_2(x)any long value >=1 x)
Deprecated
use MathFunctions.log(long) instead
calculate the logarithm to the base 2.
|
| private static double | Returns: log_2(arg)a double value with 1<= arg<= 4.768462058 arg)
Deprecated
use MathFunctions.logBKM(double) instead
BKM Algorithm to calculate logarithms to the base 2.
|
| public static int | Returns: the largest h with 2^h | a if a!=0, 0 otherwisean integer a)Compute the largest h with 2^h | a if a!=0. |
| public static long | Returns: a mod mvalue on which the modulo operation has to be performed. a, long the modulus. m)Returns a long integer whose value is (a mod m). |
| public static int | Returns: a-1 mod n- the integer to invert a, int - the modulus mod)Computes the modular inverse of an integer a |
| public static long | Returns: a-1 mod n- the integer to invert a, long - the modulus mod)Computes the modular inverse of an integer a |
| public static int | |
| public static BigInteger | Returns: the next prime greater than na integer number n)Computes the next prime greater than n. |
| public static BigInteger | Returns: the next prime greater than na integer number n, int the certainty that the generated number is prime certainty)Compute the next probable prime greater than n with the specified certainty. |
| public static BigInteger | Returns: the next prime greater than na integer number n)Compute the next probable prime greater than n with the default certainty (20). |
| public static int | Returns: the largest prime smaller than n, or 1 if n <= 2- upper bound n)Returns the largest prime smaller than the given integer |
| public static BigInteger | |
| public static BigInteger | |
| public static int | Returns: the order k of g (that is k is the smallest integer with gk = 1 mod pan integer with 1 < g < p g, int a prime p)determines the order of g modulo p, p prime and 1 < g < p. |
| public static boolean | Returns: true if the number has no factor of the tested primes, false if the number is definitely compositethe number to test candidate)Short trial-division test to find out whether a number is not prime. |
| public static int | |
| public static long | |
| public static BigInteger | |
| public static BigInteger | |
| public static BigInteger | Returns: n reduced into [begin,end]- the integer n, BigInteger - left bound of the interval begin, BigInteger - right bound of the interval end)Reduces an integer into a given interval |
| public static BigInteger | Returns: the truncated square root of a- value out of which we extract the square root a)Extract the truncated square root of a BigInteger. |
| FOUR | back to summary |
|---|---|
| private static final BigInteger FOUR | |
| jacobiTable | back to summary |
|---|---|
| private static final int[] jacobiTable | |
| ONE | back to summary |
|---|---|
| private static final BigInteger ONE | |
| SMALL_PRIME_PRODUCT | back to summary |
|---|---|
| private static final long SMALL_PRIME_PRODUCT | |
| SMALL_PRIMES | back to summary |
|---|---|
| private static final int[] SMALL_PRIMES | |
| sr | back to summary |
|---|---|
| private static SecureRandom sr | |
| TWO | back to summary |
|---|---|
| private static final BigInteger TWO | |
| ZERO | back to summary |
|---|---|
| private static final BigInteger ZERO | |
| IntegerFunctions | back to summary |
|---|---|
| private IntegerFunctions() | |
| binomial | back to summary |
|---|---|
| public static BigInteger binomial(int n, int t) Computes the binomial coefficient (n|t) ("n over t"). Formula:
| |
| bitCount | back to summary |
|---|---|
public static int bitCount(int a)
| |
| ceilLog | back to summary |
|---|---|
| public static int ceilLog(BigInteger a) Compute the smallest integer that is greater than or equal to the logarithm to the base 2 of the given BigInteger.
| |
| ceilLog | back to summary |
|---|---|
| public static int ceilLog(int a) Compute the smallest integer that is greater than or equal to the logarithm to the base 2 of the given integer.
| |
| ceilLog256 | back to summary |
|---|---|
| public static int ceilLog256(int n) Compute ceil(log_256 n), the number of bytes needed to encode the integer n.
| |
| ceilLog256 | back to summary |
|---|---|
| public static int ceilLog256(long n) Compute ceil(log_256 n), the number of bytes needed to encode the long integer n.
| |
| divideAndRound | back to summary |
|---|---|
| public static BigInteger divideAndRound(BigInteger a, BigInteger b) | |
| divideAndRound | back to summary |
|---|---|
| public static BigInteger[] divideAndRound(BigInteger[] a, BigInteger b) | |
| extGCD | back to summary |
|---|---|
| public static int[] extGCD(int a, int b) Extended euclidian algorithm (computes gcd and representation).
| |
| extgcd | back to summary |
|---|---|
| public static BigInteger[] extgcd(BigInteger a, BigInteger b) Extended euclidian algorithm (computes gcd and representation).
| |
| floatPow | back to summary |
|---|---|
| public static float floatPow(float f, int i) int power of a base float, only use for small ints
| |
| floorLog | back to summary |
|---|---|
| public static int floorLog(BigInteger a) Compute the integer part of the logarithm to the base 2 of the given integer.
| |
| floorLog | back to summary |
|---|---|
| public static int floorLog(int a) Compute the integer part of the logarithm to the base 2 of the given integer.
| |
| gcd | back to summary |
|---|---|
| public static int gcd(int u, int v) Computes the greatest common divisor of the two specified integers
| |
| integerToOctets | back to summary |
|---|---|
| public static byte[] integerToOctets(BigInteger val) | |
| intRoot | back to summary |
|---|---|
| public static float intRoot(int base, int root) Takes an approximation of the root from an integer base, using newton's algorithm
| |
| isIncreasing | back to summary |
|---|---|
| public static boolean isIncreasing(int[] a) | |
| isPower | back to summary |
|---|---|
| public static int isPower(int a, int p) Tests whether an integer a is power of another integer p.
| |
| isPrime | back to summary |
|---|---|
| public static boolean isPrime(int n) Miller-Rabin-Test, determines wether the given integer is probably prime or composite. This method returns true if the given integer is prime with probability 1 - 2-20.
| |
| jacobi | back to summary |
|---|---|
| public static int jacobi(BigInteger A, BigInteger B) Computes the value of the Jacobi symbol (A|B). The following properties hold for the Jacobi symbol which makes it a very efficient way to evaluate the Legendre symbol
(A|B) = 0 IF gcd(A,B) > 1
| |
| leastCommonMultiple | back to summary |
|---|---|
| public static BigInteger leastCommonMultiple(BigInteger[] numbers) Computation of the least common multiple of a set of BigIntegers.
| |
| leastDiv | back to summary |
|---|---|
| public static int leastDiv(int a) Find and return the least non-trivial divisor of an integer a.
| |
| log | back to summary |
|---|---|
| public static double log(double x)
Deprecated use MathFunctions.log(double) instead calculate the logarithm to the base 2.
| |
| log | back to summary |
|---|---|
| public static double log(long x)
Deprecated use MathFunctions.log(long) instead calculate the logarithm to the base 2.
| |
| logBKM | back to summary |
|---|---|
| private static double logBKM(double arg)
Deprecated use MathFunctions.logBKM(double) instead BKM Algorithm to calculate logarithms to the base 2.
| |
| maxPower | back to summary |
|---|---|
| public static int maxPower(int a) Compute the largest h with 2^h | a if a!=0.
| |
| mod | back to summary |
|---|---|
| public static long mod(long a, long m) Returns a long integer whose value is (a mod m). This method differs from % in that it always returns a non-negative integer.
| |
| modInverse | back to summary |
|---|---|
| public static int modInverse(int a, int mod) Computes the modular inverse of an integer a
| |
| modInverse | back to summary |
|---|---|
| public static long modInverse(long a, long mod) Computes the modular inverse of an integer a
| |
| modPow | back to summary |
|---|---|
| public static int modPow(int a, int e, int n) Compute ae mod n.
| |
| nextPrime | back to summary |
|---|---|
| public static BigInteger nextPrime(long n) Computes the next prime greater than n.
| |
| nextProbablePrime | back to summary |
|---|---|
| public static BigInteger nextProbablePrime(BigInteger n, int certainty) Compute the next probable prime greater than n with the specified certainty.
| |
| nextProbablePrime | back to summary |
|---|---|
| public static BigInteger nextProbablePrime(BigInteger n) Compute the next probable prime greater than n with the default certainty (20).
| |
| nextSmallerPrime | back to summary |
|---|---|
| public static int nextSmallerPrime(int n) Returns the largest prime smaller than the given integer
| |
| octetsToInteger | back to summary |
|---|---|
| public static BigInteger octetsToInteger(byte[] data, int offset, int length) | |
| octetsToInteger | back to summary |
|---|---|
| public static BigInteger octetsToInteger(byte[] data) | |
| order | back to summary |
|---|---|
| public static int order(int g, int p) determines the order of g modulo p, p prime and 1 < g < p. This algorithm is only efficient for small p (see X9.62-1998, p. 68).
| |
| passesSmallPrimeTest | back to summary |
|---|---|
| public static boolean passesSmallPrimeTest(BigInteger candidate) Short trial-division test to find out whether a number is not prime. This test is usually used before a Miller-Rabin primality test.
| |
| pow | back to summary |
|---|---|
| public static int pow(int a, int e) Compute ae.
| |
| pow | back to summary |
|---|---|
| public static long pow(long a, int e) Compute ae.
| |
| randomize | back to summary |
|---|---|
| public static BigInteger randomize(BigInteger upperBound) | |
| randomize | back to summary |
|---|---|
| public static BigInteger randomize(BigInteger upperBound, SecureRandom prng) | |
| reduceInto | back to summary |
|---|---|
| public static BigInteger reduceInto(BigInteger n, BigInteger begin, BigInteger end) Reduces an integer into a given interval
| |
| squareRoot | back to summary |
|---|---|
| public static BigInteger squareRoot(BigInteger a) Extract the truncated square root of a BigInteger.
| |