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(const(BigInt)* n)

Return the absolute value

checkPrime
bool checkPrime(const(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(const(BigInt)* a, const(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(const(BigInt)* n, const(BigInt)* mod)

Modular inversion

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

Check for primality using Miller-Rabin

jacobi
int jacobi(const(BigInt)* a, const(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(const(BigInt)* a, const(BigInt)* b)

Least common multiple

lcm
BigInt lcm(const(BigInt) a, const(BigInt) b)
Undocumented in source. Be warned that the author may not have intended to support it.
lowZeroBits
size_t lowZeroBits(const(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, const(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(const(BigInt)* a, const(BigInt)* b, const(BigInt)* c)

Fused multiply-add

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

Modular exponentation

quickCheckPrime
bool quickCheckPrime(const(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, const(BigInt)* coprime, size_t equiv, size_t modulo)
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(const(BigInt)* a, const(BigInt)* p)

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

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

Fused subtract-multiply

verifyPrime
bool verifyPrime(const(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)