summaryrefslogtreecommitdiff
path: root/nbtheory.h
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2016-12-04 16:48:27 -0500
committerJeffrey Walton <noloader@gmail.com>2016-12-04 16:48:27 -0500
commitbfc4bf9697d3dffe8130d8518945f71892e1bcef (patch)
tree58b5bb0e4aa625ff6d14722a3348fa8d850f2772 /nbtheory.h
parentd01467b754e5b54840ac757258c23c873e41affd (diff)
downloadcryptopp-git-bfc4bf9697d3dffe8130d8518945f71892e1bcef.tar.gz
Updated documentation
Diffstat (limited to 'nbtheory.h')
-rw-r--r--nbtheory.h41
1 files changed, 35 insertions, 6 deletions
diff --git a/nbtheory.h b/nbtheory.h
index c32e2ed0..0d0c4c3a 100644
--- a/nbtheory.h
+++ b/nbtheory.h
@@ -143,25 +143,54 @@ CRYPTOPP_DLL unsigned int CRYPTOPP_API FactoringWorkFactor(unsigned int bitlengt
// ********************************************************
-//! generator of prime numbers of special forms
+//! \class PrimeAndGenerator
+//! \brief Generator of prime numbers of special forms
class CRYPTOPP_DLL PrimeAndGenerator
{
public:
+ //! \brief Construct a PrimeAndGenerator
PrimeAndGenerator() {}
- // generate a random prime p of the form 2*q+delta, where delta is 1 or -1 and q is also prime
- // Precondition: pbits > 5
- // warning: this is slow, because primes of this form are harder to find
+
+ //! \brief Construct a PrimeAndGenerator
+ //! \param delta +1 or -1
+ //! \param rng a RandomNumberGenerator derived class
+ //! \param pbits the number of bits in the prime p
+ //! \details PrimeAndGenerator() generates a random prime p of the form <tt>2*q+delta</tt>, where delta is 1 or -1 and q is
+ //! also prime. Internally the constructor calls <tt>Generate(delta, rng, pbits, pbits-1)</tt>.
+ //! \pre <tt>pbits > 5</tt>
+ //! \warning This PrimeAndGenerator() is slow because primes of this form are harder to find.
PrimeAndGenerator(signed int delta, RandomNumberGenerator &rng, unsigned int pbits)
{Generate(delta, rng, pbits, pbits-1);}
- // generate a random prime p of the form 2*r*q+delta, where q is also prime
- // Precondition: qbits > 4 && pbits > qbits
+
+ //! \brief Construct a PrimeAndGenerator
+ //! \param delta +1 or -1
+ //! \param rng a RandomNumberGenerator derived class
+ //! \param pbits the number of bits in the prime p
+ //! \param qbits the number of bits in the prime q
+ //! \details PrimeAndGenerator() generates a random prime p of the form <tt>2*r*q+delta</tt>, where q is also prime.
+ //! Internally the constructor calls <tt>Generate(delta, rng, pbits, qbits)</tt>.
+ //! \pre <tt>qbits > 4 && pbits > qbits</tt>
PrimeAndGenerator(signed int delta, RandomNumberGenerator &rng, unsigned int pbits, unsigned qbits)
{Generate(delta, rng, pbits, qbits);}
+ //! \brief Generate a Prime and Generator
+ //! \param delta +1 or -1
+ //! \param rng a RandomNumberGenerator derived class
+ //! \param pbits the number of bits in the prime p
+ //! \param qbits the number of bits in the prime q
+ //! \details Generate() generates a random prime p of the form <tt>2*r*q+delta</tt>, where q is also prime.
void Generate(signed int delta, RandomNumberGenerator &rng, unsigned int pbits, unsigned qbits);
+ //! \brief Retrieve first prime
+ //! \returns Prime() returns the prime p.
const Integer& Prime() const {return p;}
+
+ //! \brief Retrieve second prime
+ //! \returns SubPrime() returns the prime q.
const Integer& SubPrime() const {return q;}
+
+ //! \brief Retrieve the generator
+ //! \returns Generator() returns the the generator g.
const Integer& Generator() const {return g;}
private: