Fabcoin Core
0.16.2
P2P Digital Currency
|
Generator of prime numbers of special forms. More...
#include <nbtheory.h>
Public Member Functions | |
PrimeAndGenerator () | |
Construct a PrimeAndGenerator. More... | |
PrimeAndGenerator (signed int delta, RandomNumberGenerator &rng, unsigned int pbits) | |
Construct a PrimeAndGenerator. More... | |
PrimeAndGenerator (signed int delta, RandomNumberGenerator &rng, unsigned int pbits, unsigned qbits) | |
Construct a PrimeAndGenerator. More... | |
void | Generate (signed int delta, RandomNumberGenerator &rng, unsigned int pbits, unsigned qbits) |
Generate a Prime and Generator. More... | |
const Integer & | Prime () const |
Retrieve first prime. More... | |
const Integer & | SubPrime () const |
Retrieve second prime. More... | |
const Integer & | Generator () const |
Retrieve the generator. More... | |
Private Attributes | |
Integer | p |
Integer | q |
Integer | g |
Generator of prime numbers of special forms.
Definition at line 148 of file nbtheory.h.
|
inline |
Construct a PrimeAndGenerator.
Definition at line 152 of file nbtheory.h.
|
inline |
Construct a PrimeAndGenerator.
delta | +1 or -1 |
rng | a RandomNumberGenerator derived class |
pbits | the number of bits in the prime p |
PrimeAndGenerator() generates a random prime p of the form 2*q+delta
, where delta is 1 or -1 and q is also prime. Internally the constructor calls Generate(delta, rng, pbits, pbits-1)
.
pbits > 5
Definition at line 162 of file nbtheory.h.
|
inline |
Construct a PrimeAndGenerator.
delta | +1 or -1 |
rng | a RandomNumberGenerator derived class |
pbits | the number of bits in the prime p |
qbits | the number of bits in the prime q |
PrimeAndGenerator() generates a random prime p of the form 2*r*q+delta
, where q is also prime. Internally the constructor calls Generate(delta, rng, pbits, qbits)
.
qbits > 4 && pbits > qbits
Definition at line 173 of file nbtheory.h.
void PrimeAndGenerator::Generate | ( | signed int | delta, |
RandomNumberGenerator & | rng, | ||
unsigned int | pbits, | ||
unsigned | qbits | ||
) |
Generate a Prime and Generator.
delta | +1 or -1 |
rng | a RandomNumberGenerator derived class |
pbits | the number of bits in the prime p |
qbits | the number of bits in the prime q |
Generate() generates a random prime p of the form 2*r*q+delta
, where q is also prime.
Definition at line 1038 of file nbtheory.cpp.
|
inline |
Retrieve the generator.
Definition at line 194 of file nbtheory.h.
|
inline |
Retrieve first prime.
Definition at line 186 of file nbtheory.h.
|
inline |
Retrieve second prime.
Definition at line 190 of file nbtheory.h.
|
private |
Definition at line 197 of file nbtheory.h.
|
private |
Definition at line 197 of file nbtheory.h.
|
private |
Definition at line 197 of file nbtheory.h.