Fabcoin Core
0.16.2
P2P Digital Currency
|
Polynomial with Coefficients in GF(2) More...
#include <gf2n.h>
Classes | |
class | DivideByZero |
Excpetion thrown when divide by zero is encountered. More... | |
Private Attributes | |
SecWordBlock | reg |
Friends | |
class | GF2NT |
ENUMS, EXCEPTIONS, and TYPEDEFS | |
typedef unsigned int | RandomizationParameter |
CREATORS | |
PolynomialMod2 () | |
Construct the zero polynomial. More... | |
PolynomialMod2 (const PolynomialMod2 &t) | |
Copy construct a PolynomialMod2. More... | |
PolynomialMod2 (word value, size_t bitLength=WORD_BITS) | |
Construct a PolynomialMod2 from a word. More... | |
PolynomialMod2 (const byte *encodedPoly, size_t byteCount) | |
Construct a PolynomialMod2 from big-endian byte array. More... | |
PolynomialMod2 (BufferedTransformation &encodedPoly, size_t byteCount) | |
Construct a PolynomialMod2 from big-endian form stored in a BufferedTransformation. More... | |
PolynomialMod2 (RandomNumberGenerator &rng, size_t bitcount) | |
Create a uniformly distributed random polynomial. More... | |
static PolynomialMod2 CRYPTOPP_API | Monomial (size_t i) |
Provides x^i. More... | |
static PolynomialMod2 CRYPTOPP_API | Trinomial (size_t t0, size_t t1, size_t t2) |
Provides x^t0 + x^t1 + x^t2. More... | |
static PolynomialMod2 CRYPTOPP_API | Pentanomial (size_t t0, size_t t1, size_t t2, size_t t3, size_t t4) |
Provides x^t0 + x^t1 + x^t2 + x^t3 + x^t4. More... | |
static PolynomialMod2 CRYPTOPP_API | AllOnes (size_t n) |
Provides x^(n-1) + ... More... | |
static const PolynomialMod2 &CRYPTOPP_API | Zero () |
The Zero polinomial. More... | |
static const PolynomialMod2 &CRYPTOPP_API | One () |
The One polinomial. More... | |
ENCODE/DECODE | |
unsigned int | MinEncodedSize () const |
minimum number of bytes to encode this polynomial More... | |
void | Encode (byte *output, size_t outputLen) const |
encode in big-endian format More... | |
void | Encode (BufferedTransformation &bt, size_t outputLen) const |
void | Decode (const byte *input, size_t inputLen) |
void | Decode (BufferedTransformation &bt, size_t inputLen) |
void | DEREncodeAsOctetString (BufferedTransformation &bt, size_t length) const |
encode value as big-endian octet string More... | |
void | BERDecodeAsOctetString (BufferedTransformation &bt, size_t length) |
decode value as big-endian octet string More... | |
ACCESSORS | |
unsigned int | BitCount () const |
number of significant bits = Degree() + 1 More... | |
unsigned int | ByteCount () const |
number of significant bytes = ceiling(BitCount()/8) More... | |
unsigned int | WordCount () const |
number of significant words = ceiling(ByteCount()/sizeof(word)) More... | |
bool | GetBit (size_t n) const |
return the n-th bit, n=0 being the least significant bit More... | |
byte | GetByte (size_t n) const |
return the n-th byte More... | |
signed int | Degree () const |
the zero polynomial will return a degree of -1 More... | |
unsigned int | CoefficientCount () const |
degree + 1 More... | |
int | GetCoefficient (size_t i) const |
return coefficient for x^i More... | |
int | operator[] (unsigned int i) const |
return coefficient for x^i More... | |
bool | IsZero () const |
bool | Equals (const PolynomialMod2 &rhs) const |
MANIPULATORS | |
PolynomialMod2 & | operator= (const PolynomialMod2 &t) |
PolynomialMod2 & | operator&= (const PolynomialMod2 &t) |
PolynomialMod2 & | operator^= (const PolynomialMod2 &t) |
PolynomialMod2 & | operator+= (const PolynomialMod2 &t) |
PolynomialMod2 & | operator-= (const PolynomialMod2 &t) |
PolynomialMod2 & | operator*= (const PolynomialMod2 &t) |
PolynomialMod2 & | operator/= (const PolynomialMod2 &t) |
PolynomialMod2 & | operator%= (const PolynomialMod2 &t) |
PolynomialMod2 & | operator<<= (unsigned int) |
PolynomialMod2 & | operator>>= (unsigned int) |
void | Randomize (RandomNumberGenerator &rng, size_t bitcount) |
void | SetBit (size_t i, int value=1) |
void | SetByte (size_t n, byte value) |
set the n-th byte to value More... | |
void | SetCoefficient (size_t i, int value) |
void | swap (PolynomialMod2 &a) |
UNARY OPERATORS | |
bool | operator! () const |
PolynomialMod2 | operator+ () const |
PolynomialMod2 | operator- () const |
BINARY OPERATORS | |
PolynomialMod2 | And (const PolynomialMod2 &b) const |
PolynomialMod2 | Xor (const PolynomialMod2 &b) const |
PolynomialMod2 | Plus (const PolynomialMod2 &b) const |
PolynomialMod2 | Minus (const PolynomialMod2 &b) const |
PolynomialMod2 | Times (const PolynomialMod2 &b) const |
PolynomialMod2 | DividedBy (const PolynomialMod2 &b) const |
PolynomialMod2 | Modulo (const PolynomialMod2 &b) const |
PolynomialMod2 | operator>> (unsigned int n) const |
PolynomialMod2 | operator<< (unsigned int n) const |
OTHER ARITHMETIC FUNCTIONS | |
unsigned int | Parity () const |
sum modulo 2 of all coefficients More... | |
bool | IsIrreducible () const |
check for irreducibility More... | |
PolynomialMod2 | Doubled () const |
is always zero since we're working modulo 2 More... | |
PolynomialMod2 | Squared () const |
bool | IsUnit () const |
only 1 is a unit More... | |
PolynomialMod2 | MultiplicativeInverse () const |
return inverse if *this is a unit, otherwise return 0 More... | |
PolynomialMod2 | InverseMod (const PolynomialMod2 &) const |
calculate multiplicative inverse of *this mod n More... | |
static PolynomialMod2 CRYPTOPP_API | Gcd (const PolynomialMod2 &a, const PolynomialMod2 &n) |
greatest common divisor More... | |
static void CRYPTOPP_API | Divide (PolynomialMod2 &r, PolynomialMod2 &q, const PolynomialMod2 &a, const PolynomialMod2 &d) |
calculate r and q such that (a == d*q + r) && (deg(r) < deg(d)) More... | |
INPUT/OUTPUT | |
std::ostream & | operator<< (std::ostream &out, const PolynomialMod2 &a) |
typedef unsigned int PolynomialMod2::RandomizationParameter |
PolynomialMod2::PolynomialMod2 | ( | ) |
PolynomialMod2::PolynomialMod2 | ( | const PolynomialMod2 & | t | ) |
Copy construct a PolynomialMod2.
Definition at line 45 of file gf2n.cpp.
Construct a PolynomialMod2 from a 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
Definition at line 33 of file gf2n.cpp.
|
inline |
Construct a PolynomialMod2 from big-endian byte array.
|
inline |
Construct a PolynomialMod2 from big-endian form stored in a BufferedTransformation.
|
inline |
|
static |
PolynomialMod2 PolynomialMod2::And | ( | const PolynomialMod2 & | b | ) | const |
void PolynomialMod2::BERDecodeAsOctetString | ( | BufferedTransformation & | bt, |
size_t | length | ||
) |
unsigned int PolynomialMod2::BitCount | ( | ) | const |
unsigned int PolynomialMod2::ByteCount | ( | ) | const |
number of significant bytes = ceiling(BitCount()/8)
Definition at line 195 of file gf2n.cpp.
|
inline |
void PolynomialMod2::Decode | ( | const byte * | input, |
size_t | inputLen | ||
) |
void PolynomialMod2::Decode | ( | BufferedTransformation & | bt, |
size_t | inputLen | ||
) |
|
inline |
void PolynomialMod2::DEREncodeAsOctetString | ( | BufferedTransformation & | bt, |
size_t | length | ||
) | const |
|
static |
PolynomialMod2 PolynomialMod2::DividedBy | ( | const PolynomialMod2 & | b | ) | const |
|
inline |
void PolynomialMod2::Encode | ( | byte * | output, |
size_t | outputLen | ||
) | const |
void PolynomialMod2::Encode | ( | BufferedTransformation & | bt, |
size_t | outputLen | ||
) | const |
bool PolynomialMod2::Equals | ( | const PolynomialMod2 & | rhs | ) | const |
|
static |
|
inline |
byte PolynomialMod2::GetByte | ( | size_t | n | ) | const |
|
inline |
PolynomialMod2 PolynomialMod2::InverseMod | ( | const PolynomialMod2 & | modulus | ) | const |
bool PolynomialMod2::IsIrreducible | ( | ) | const |
|
inline |
|
inline |
|
inline |
|
inline |
PolynomialMod2 PolynomialMod2::Modulo | ( | const PolynomialMod2 & | b | ) | const |
|
static |
|
inline |
|
static |
bool PolynomialMod2::operator! | ( | ) | const |
PolynomialMod2& PolynomialMod2::operator%= | ( | const PolynomialMod2 & | t | ) |
PolynomialMod2& PolynomialMod2::operator&= | ( | const PolynomialMod2 & | t | ) |
PolynomialMod2& PolynomialMod2::operator*= | ( | const PolynomialMod2 & | t | ) |
|
inline |
|
inline |
|
inline |
|
inline |
PolynomialMod2& PolynomialMod2::operator/= | ( | const PolynomialMod2 & | t | ) |
PolynomialMod2 PolynomialMod2::operator<< | ( | unsigned int | n | ) | const |
PolynomialMod2 & PolynomialMod2::operator<<= | ( | unsigned int | n | ) |
PolynomialMod2 & PolynomialMod2::operator= | ( | const PolynomialMod2 & | t | ) |
PolynomialMod2 PolynomialMod2::operator>> | ( | unsigned int | n | ) | const |
PolynomialMod2 & PolynomialMod2::operator>>= | ( | unsigned int | n | ) |
|
inline |
PolynomialMod2 & PolynomialMod2::operator^= | ( | const PolynomialMod2 & | t | ) |
unsigned int PolynomialMod2::Parity | ( | ) | const |
|
static |
|
inline |
void PolynomialMod2::Randomize | ( | RandomNumberGenerator & | rng, |
size_t | bitcount | ||
) |
void PolynomialMod2::SetBit | ( | size_t | i, |
int | value = 1 |
||
) |
void PolynomialMod2::SetByte | ( | size_t | n, |
byte | value | ||
) |
|
inline |
PolynomialMod2 PolynomialMod2::Squared | ( | ) | const |
|
inline |
PolynomialMod2 PolynomialMod2::Times | ( | const PolynomialMod2 & | b | ) | const |
|
static |
unsigned int PolynomialMod2::WordCount | ( | ) | const |
number of significant words = ceiling(ByteCount()/sizeof(word))
Definition at line 190 of file gf2n.cpp.
PolynomialMod2 PolynomialMod2::Xor | ( | const PolynomialMod2 & | b | ) | const |
|
static |
|
friend |
|
private |