Update docs

Thanks to Bing Shi
This commit is contained in:
Jeffrey Walton 2023-11-19 20:32:16 -05:00
parent 3e3b8af96d
commit eb383b8e16
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
2 changed files with 10 additions and 0 deletions

View File

@ -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);
@ -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);

2
gf2n.h
View File

@ -69,9 +69,11 @@ public:
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