Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
Thanks to Bing Shi
  • Loading branch information
noloader committed Nov 20, 2023
1 parent 3e3b8af commit eb383b8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions gf2n.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ PolynomialMod2 PolynomialMod2::Monomial(size_t i)

PolynomialMod2 PolynomialMod2::Trinomial(size_t t0, size_t t1, size_t t2)
{
CRYPTOPP_ASSERT(t0 > t1);
CRYPTOPP_ASSERT(t1 > t2);

PolynomialMod2 r((word)0, t0+1);
r.SetBit(t0);
r.SetBit(t1);
Expand All @@ -144,6 +147,11 @@ PolynomialMod2 PolynomialMod2::Trinomial(size_t t0, size_t t1, size_t t2)

PolynomialMod2 PolynomialMod2::Pentanomial(size_t t0, size_t t1, size_t t2, size_t t3, size_t t4)
{
CRYPTOPP_ASSERT(t0 > t1);
CRYPTOPP_ASSERT(t1 > t2);
CRYPTOPP_ASSERT(t2 > t3);
CRYPTOPP_ASSERT(t3 > t4);

PolynomialMod2 r((word)0, t0+1);
r.SetBit(t0);
r.SetBit(t1);
Expand Down
2 changes: 2 additions & 0 deletions gf2n.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,11 @@ class CRYPTOPP_DLL PolynomialMod2
static PolynomialMod2 CRYPTOPP_API Monomial(size_t i);
/// \brief Provides x^t0 + x^t1 + x^t2
/// \return x^t0 + x^t1 + x^t2
/// \pre The coefficients should be provided in descending order. That is, <pre>t0 > t1 > t2<pre>.
static PolynomialMod2 CRYPTOPP_API Trinomial(size_t t0, size_t t1, size_t t2);
/// \brief Provides x^t0 + x^t1 + x^t2 + x^t3 + x^t4
/// \return x^t0 + x^t1 + x^t2 + x^t3 + x^t4
/// \pre The coefficients should be provided in descending order. That is, <pre>t0 > t1 > t2 > t3 > t4<pre>.
static PolynomialMod2 CRYPTOPP_API Pentanomial(size_t t0, size_t t1, size_t t2, size_t t3, size_t t4);
/// \brief Provides x^(n-1) + ... + x + 1
/// \return x^(n-1) + ... + x + 1
Expand Down

0 comments on commit eb383b8

Please sign in to comment.