summaryrefslogtreecommitdiff
path: root/gf2n.h
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2016-10-18 20:21:47 -0400
committerJeffrey Walton <noloader@gmail.com>2016-10-18 20:21:47 -0400
commitb49343398b43e7d3d7dd9e25bb32c19c1fd680ad (patch)
tree9d115248c88d91af389823203bdbe26ccc3aaed7 /gf2n.h
parent1f054924b4ac0b6631a1a84c4882dab5108aa651 (diff)
downloadcryptopp-git-b49343398b43e7d3d7dd9e25bb32c19c1fd680ad.tar.gz
Updated documentation
Diffstat (limited to 'gf2n.h')
-rw-r--r--gf2n.h60
1 files changed, 34 insertions, 26 deletions
diff --git a/gf2n.h b/gf2n.h
index bfd19027..29a1e407 100644
--- a/gf2n.h
+++ b/gf2n.h
@@ -1,8 +1,11 @@
+// gf2n.h - written and placed in the public domain by Wei Dai
+
+//! \file gf2n.h
+//! \brief Classes and functions for schemes over GF(2^n)
+
#ifndef CRYPTOPP_GF2N_H
#define CRYPTOPP_GF2N_H
-/*! \file */
-
#include "cryptlib.h"
#include "secblock.h"
#include "algebra.h"
@@ -13,14 +16,14 @@
NAMESPACE_BEGIN(CryptoPP)
-//! Polynomial with Coefficients in GF(2)
+//! \brief Polynomial with Coefficients in GF(2)
/*! \nosubgrouping */
class CRYPTOPP_DLL PolynomialMod2
{
public:
//! \name ENUMS, EXCEPTIONS, and TYPEDEFS
//@{
- //! divide by zero exception
+ //! \brief Excpetion thrown when divide by zero is encountered
class DivideByZero : public Exception
{
public:
@@ -32,42 +35,48 @@ public:
//! \name CREATORS
//@{
- //! creates the zero polynomial
+ //! \brief Construct the zero polynomial
PolynomialMod2();
- //! copy constructor
+ //! Copy construct a PolynomialMod2
PolynomialMod2(const PolynomialMod2& t);
- //! convert from word
- /*! value should be encoded with the least significant bit as coefficient to x^0
- and most significant bit as coefficient to x^(WORD_BITS-1)
- bitLength denotes how much memory to allocate initially
- */
+ //! \brief Construct a PolynomialMod2 from a word
+ //! \details value should be encoded with the least significant bit as coefficient to x^0
+ //! and most significant bit as coefficient to x^(WORD_BITS-1)
+ //! bitLength denotes how much memory to allocate initially
PolynomialMod2(word value, size_t bitLength=WORD_BITS);
- //! convert from big-endian byte array
+ //! \brief Construct a PolynomialMod2 from big-endian byte array
PolynomialMod2(const byte *encodedPoly, size_t byteCount)
{Decode(encodedPoly, byteCount);}
- //! convert from big-endian form stored in a BufferedTransformation
+ //! \brief Construct a PolynomialMod2 from big-endian form stored in a BufferedTransformation
PolynomialMod2(BufferedTransformation &encodedPoly, size_t byteCount)
{Decode(encodedPoly, byteCount);}
- //! create a random polynomial uniformly distributed over all polynomials with degree less than bitcount
+ //! \brief Create a uniformly distributed random polynomial
+ //! \brief Create a random polynomial uniformly distributed over all polynomials with degree less than bitcount
PolynomialMod2(RandomNumberGenerator &rng, size_t bitcount)
{Randomize(rng, bitcount);}
- //! return x^i
+ //! \brief Provides x^i
+ //! \returns x^i
static PolynomialMod2 CRYPTOPP_API Monomial(size_t i);
- //! return x^t0 + x^t1 + x^t2
+ //! \brief Provides x^t0 + x^t1 + x^t2
+ //! \returns x^t0 + x^t1 + x^t2
static PolynomialMod2 CRYPTOPP_API Trinomial(size_t t0, size_t t1, size_t t2);
- //! return x^t0 + x^t1 + x^t2 + x^t3 + x^t4
+ //! \brief Provides x^t0 + x^t1 + x^t2 + x^t3 + x^t4
+ //! \returns x^t0 + x^t1 + x^t2 + x^t3 + x^t4
static PolynomialMod2 CRYPTOPP_API Pentanomial(size_t t0, size_t t1, size_t t2, size_t t3, size_t t4);
- //! return x^(n-1) + ... + x + 1
+ //! \brief Provides x^(n-1) + ... + x + 1
+ //! \returns x^(n-1) + ... + x + 1
static PolynomialMod2 CRYPTOPP_API AllOnes(size_t n);
- //!
+ //! \brief The Zero polinomial
+ //! \returns the zero polynomial
static const PolynomialMod2 & CRYPTOPP_API Zero();
- //!
+ //! \brief The One polinomial
+ //! \returns the one polynomial
static const PolynomialMod2 & CRYPTOPP_API One();
//@}
@@ -78,9 +87,8 @@ public:
unsigned int MinEncodedSize() const {return STDMAX(1U, ByteCount());}
//! encode in big-endian format
- /*! if outputLen < MinEncodedSize, the most significant bytes will be dropped
- if outputLen > MinEncodedSize, the most significant bytes will be padded
- */
+ //! \details if outputLen < MinEncodedSize, the most significant bytes will be dropped
+ //! if outputLen > MinEncodedSize, the most significant bytes will be padded
void Encode(byte *output, size_t outputLen) const;
//!
void Encode(BufferedTransformation &bt, size_t outputLen) const;
@@ -278,7 +286,7 @@ CRYPTOPP_DLL_TEMPLATE_CLASS AbstractEuclideanDomain<PolynomialMod2>;
CRYPTOPP_DLL_TEMPLATE_CLASS EuclideanDomainOf<PolynomialMod2>;
CRYPTOPP_DLL_TEMPLATE_CLASS QuotientRing<EuclideanDomainOf<PolynomialMod2> >;
-//! GF(2^n) with Polynomial Basis
+//! \brief GF(2^n) with Polynomial Basis
class CRYPTOPP_DLL GF2NP : public QuotientRing<EuclideanDomainOf<PolynomialMod2> >
{
public:
@@ -314,7 +322,7 @@ protected:
unsigned int m;
};
-//! GF(2^n) with Trinomial Basis
+//! \brief GF(2^n) with Trinomial Basis
class CRYPTOPP_DLL GF2NT : public GF2NP
{
public:
@@ -338,7 +346,7 @@ private:
mutable PolynomialMod2 result;
};
-//! GF(2^n) with Pentanomial Basis
+//! \brief GF(2^n) with Pentanomial Basis
class CRYPTOPP_DLL GF2NPP : public GF2NP
{
public: