botan.math.numbertheory.numthry

Number Theory Functions

Public Imports

botan.math.bigint.bigint
public import botan.math.bigint.bigint;
Undocumented in source.
botan.math.numbertheory.pow_mod
public import botan.math.numbertheory.pow_mod;
Undocumented in source.
botan.math.numbertheory.primes
public import botan.math.numbertheory.primes;
Undocumented in source.
botan.utils.types
public import botan.utils.types;
Undocumented in source.

Members

Functions

abs
BigInt abs(BigInt n)

Return the absolute value

checkPrime
bool checkPrime(BigInt n, RandomNumberGenerator rng)
Undocumented in source. Be warned that the author may not have intended to support it.
fips1863ValidSize
bool fips1863ValidSize(size_t pbits, size_t qbits)
Undocumented in source. Be warned that the author may not have intended to support it.
gcd
BigInt gcd(BigInt a, BigInt b)

Compute the greatest common divisor

generateDsaPrimes
Vector!ubyte generateDsaPrimes(RandomNumberGenerator rng, AlgorithmFactory af, BigInt p_out, BigInt q_out, size_t pbits, size_t qbits)

Generate DSA parameters using the FIPS 186 kosherizer

generateDsaPrimes
bool generateDsaPrimes(RandomNumberGenerator rng, AlgorithmFactory af, BigInt p_out, BigInt q_out, size_t pbits, size_t qbits, Vector!ubyte seed_c)

Generate DSA parameters using the FIPS 186 kosherizer

inverseMod
BigInt inverseMod(BigInt n, BigInt mod)

Modular inversion

inverseModOddModulus
BigInt inverseModOddModulus(BigInt n, BigInt mod)
Undocumented in source. Be warned that the author may not have intended to support it.
isPrime
bool isPrime(BigInt n, RandomNumberGenerator rng, size_t prob, bool is_random)

Check for primality using Miller-Rabin

jacobi
int jacobi(BigInt a, BigInt n)

Compute the Jacobi symbol. If n is prime, this is equivalent to the Legendre symbol. @see http://mathworld.wolfram.com/JacobiSymbol.html

lcm
BigInt lcm(BigInt a, BigInt b)

Least common multiple

lowZeroBits
size_t lowZeroBits(BigInt n)
montyInverse
word montyInverse(word input)
Undocumented in source. Be warned that the author may not have intended to support it.
mrTestIterations
size_t mrTestIterations(size_t n_bits, size_t prob, bool random)
Undocumented in source. Be warned that the author may not have intended to support it.
mrWitness
bool mrWitness(BigInt y, T reducer_n, BigInt n_minus_1, size_t s)
Undocumented in source. Be warned that the author may not have intended to support it.
mulAdd
BigInt mulAdd(BigInt a, BigInt b, BigInt c)

Fused multiply-add

powerMod
BigInt powerMod(BigInt base, BigInt exp, BigInt mod)

Modular exponentation

quickCheckPrime
bool quickCheckPrime(BigInt n, RandomNumberGenerator rng)
Undocumented in source. Be warned that the author may not have intended to support it.
randomPrime
BigInt randomPrime(RandomNumberGenerator rng, size_t bits, BigInt coprime, size_t equiv, size_t modulo)

Randomly generate a prime

randomSafePrime
BigInt randomSafePrime(RandomNumberGenerator rng, size_t bits)

Return a random 'safe' prime, of the form p=2*q+1 with q prime

ressol
BigInt ressol(BigInt a, BigInt p)

Compute the square root of x modulo a prime using the Shanks-Tonnelli algorithm

square
BigInt square(BigInt x)
subMul
BigInt subMul(BigInt a, BigInt b, BigInt c)

Fused subtract-multiply

verifyPrime
bool verifyPrime(BigInt n, RandomNumberGenerator rng)
Undocumented in source. Be warned that the author may not have intended to support it.

Meta

License

Botan is released under the Simplified BSD License (see LICENSE.md)