Fabcoin Core
0.16.2
P2P Digital Currency
|
Classes and functions for number theoretic operations. More...
Go to the source code of this file.
Classes | |
class | PrimeSelector |
Application callback to signal suitability of a cabdidate prime. More... | |
class | PrimeAndGenerator |
Generator of prime numbers of special forms. More... | |
Classes and functions for number theoretic operations.
Definition in file nbtheory.h.
CRYPTOPP_DLL Integer CRYPTOPP_API CRT | ( | const Integer & | xp, |
const Integer & | p, | ||
const Integer & | xq, | ||
const Integer & | q, | ||
const Integer & | u | ||
) |
CRYPTOPP_DLL unsigned int CRYPTOPP_API DiscreteLogWorkFactor | ( | unsigned int | bitlength | ) |
Definition at line 111 of file nbtheory.h.
CRYPTOPP_DLL unsigned int CRYPTOPP_API FactoringWorkFactor | ( | unsigned int | bitlength | ) |
CRYPTOPP_DLL bool CRYPTOPP_API FirstPrime | ( | Integer & | p, |
const Integer & | max, | ||
const Integer & | equiv, | ||
const Integer & | mod, | ||
const PrimeSelector * | pSelector | ||
) |
Finds a random prime of special form.
p | an Integer reference to receive the prime |
max | the maximum value |
equiv | the equivalence class based on the parameter mod |
mod | the modulus used to reduce the equivalence class |
pSelector | pointer to a PrimeSelector function for the application to signal suitability |
FirstPrime() uses a fast sieve to find the first probable prime in {x | p<=x<=max and xmod==equiv}
Definition at line 381 of file nbtheory.cpp.
Definition at line 105 of file nbtheory.h.
CRYPTOPP_DLL const word16* CRYPTOPP_API GetPrimeTable | ( | unsigned int & | size | ) |
CRYPTOPP_DLL Integer CRYPTOPP_API InverseLucas | ( | const Integer & | e, |
const Integer & | m, | ||
const Integer & | p, | ||
const Integer & | q, | ||
const Integer & | u | ||
) |
Definition at line 1000 of file nbtheory.cpp.
CRYPTOPP_DLL bool CRYPTOPP_API IsFermatProbablePrime | ( | const Integer & | n, |
const Integer & | b | ||
) |
CRYPTOPP_DLL bool CRYPTOPP_API IsLucasProbablePrime | ( | const Integer & | n | ) |
CRYPTOPP_DLL bool CRYPTOPP_API IsPrime | ( | const Integer & | p | ) |
Verifies a prime number.
p | a candidate prime to test |
IsPrime() is suitable for testing candidate primes when creating them. Internally, IsPrime() utilizes SmallDivisorsTest(), IsStrongProbablePrime() and IsStrongLucasProbablePrime().
Definition at line 239 of file nbtheory.cpp.
CRYPTOPP_DLL bool CRYPTOPP_API IsSmallPrime | ( | const Integer & | p | ) |
Tests whether a number is a small prime.
p | a candidate prime to test |
Internally, the library maintains a table fo the first 32719 prime numbers in sorted order. IsSmallPrime() searches the table and returns true if p is in the table.
Definition at line 62 of file nbtheory.cpp.
CRYPTOPP_DLL bool CRYPTOPP_API IsStrongLucasProbablePrime | ( | const Integer & | n | ) |
Definition at line 184 of file nbtheory.cpp.
CRYPTOPP_DLL bool CRYPTOPP_API IsStrongProbablePrime | ( | const Integer & | n, |
const Integer & | b | ||
) |
Definition at line 107 of file nbtheory.cpp.
CRYPTOPP_DLL int CRYPTOPP_API Jacobi | ( | const Integer & | a, |
const Integer & | b | ||
) |
Definition at line 787 of file nbtheory.cpp.
Definition at line 109 of file nbtheory.h.
CRYPTOPP_DLL Integer CRYPTOPP_API Lucas | ( | const Integer & | e, |
const Integer & | p, | ||
const Integer & | n | ||
) |
Definition at line 814 of file nbtheory.cpp.
CRYPTOPP_DLL AlgorithmParameters CRYPTOPP_API MakeParametersForTwoPrimesOfEqualSize | ( | unsigned int | productBitLength | ) |
Definition at line 267 of file nbtheory.cpp.
CRYPTOPP_DLL Integer CRYPTOPP_API MaurerProvablePrime | ( | RandomNumberGenerator & | rng, |
unsigned int | bits | ||
) |
Generates a provable prime.
rng | a RandomNumberGenerator to produce keying material |
bits | the number of bits in the prime number |
Definition at line 512 of file nbtheory.cpp.
CRYPTOPP_DLL Integer CRYPTOPP_API MihailescuProvablePrime | ( | RandomNumberGenerator & | rng, |
unsigned int | bits | ||
) |
Generates a provable prime.
rng | a RandomNumberGenerator to produce keying material |
bits | the number of bits in the prime number |
Mihailescu's methods performs a search using algorithmic progressions.
Definition at line 472 of file nbtheory.cpp.
Definition at line 126 of file nbtheory.h.
CRYPTOPP_DLL Integer CRYPTOPP_API ModularRoot | ( | const Integer & | a, |
const Integer & | dp, | ||
const Integer & | dq, | ||
const Integer & | p, | ||
const Integer & | q, | ||
const Integer & | u | ||
) |
Definition at line 648 of file nbtheory.cpp.
CRYPTOPP_DLL Integer CRYPTOPP_API ModularSquareRoot | ( | const Integer & | a, |
const Integer & | p | ||
) |
Definition at line 574 of file nbtheory.cpp.
CRYPTOPP_DLL unsigned int CRYPTOPP_API PrimeSearchInterval | ( | const Integer & | max | ) |
Definition at line 257 of file nbtheory.cpp.
CRYPTOPP_DLL bool CRYPTOPP_API RabinMillerTest | ( | RandomNumberGenerator & | rng, |
const Integer & | w, | ||
unsigned int | rounds | ||
) |
Definition at line 140 of file nbtheory.cpp.
Definition at line 107 of file nbtheory.h.
CRYPTOPP_DLL bool CRYPTOPP_API SmallDivisorsTest | ( | const Integer & | p | ) |
Definition at line 91 of file nbtheory.cpp.
CRYPTOPP_DLL bool CRYPTOPP_API SolveModularQuadraticEquation | ( | Integer & | r1, |
Integer & | r2, | ||
const Integer & | a, | ||
const Integer & | b, | ||
const Integer & | c, | ||
const Integer & | p | ||
) |
Definition at line 623 of file nbtheory.cpp.
CRYPTOPP_DLL bool CRYPTOPP_API TrialDivision | ( | const Integer & | p, |
unsigned | bound | ||
) |
TrialDivision() true if p is divisible by some prime less than bound. bound not be greater than the largest entry in the prime table, which is 32719.
Definition at line 73 of file nbtheory.cpp.
CRYPTOPP_DLL bool CRYPTOPP_API VerifyPrime | ( | RandomNumberGenerator & | rng, |
const Integer & | p, | ||
unsigned int | level = 1 |
||
) |
Verifies a prime number.
rng | a RandomNumberGenerator for randomized testing |
p | a candidate prime to test |
level | the level of thoroughness of testing |
VerifyPrime() is suitable for testing candidate primes created by others. Internally, VerifyPrime() utilizes IsPrime() and one-round RabinMillerTest(). If the candiate passes and level is greater than 1, then 10 round RabinMillerTest() primality testing is performed.
Definition at line 249 of file nbtheory.cpp.