Crypto++ 8.7
Free C++ class library of cryptographic schemes
|
Abstract group. More...
#include <algebra.h>
Public Types | |
typedef T | Element |
Public Member Functions | |
virtual bool | Equal (const Element &a, const Element &b) const =0 |
Compare two elements for equality. More... | |
virtual const Element & | Identity () const =0 |
Provides the Identity element. More... | |
virtual const Element & | Add (const Element &a, const Element &b) const =0 |
Adds elements in the group. More... | |
virtual const Element & | Inverse (const Element &a) const =0 |
Inverts the element in the group. More... | |
virtual bool | InversionIsFast () const |
Determine if inversion is fast. More... | |
virtual const Element & | Double (const Element &a) const |
Doubles an element in the group. More... | |
virtual const Element & | Subtract (const Element &a, const Element &b) const |
Subtracts elements in the group. More... | |
virtual Element & | Accumulate (Element &a, const Element &b) const |
TODO. More... | |
virtual Element & | Reduce (Element &a, const Element &b) const |
Reduces an element in the congruence class. More... | |
virtual Element | ScalarMultiply (const Element &a, const Integer &e) const |
Performs a scalar multiplication. More... | |
virtual Element | CascadeScalarMultiply (const Element &x, const Integer &e1, const Element &y, const Integer &e2) const |
TODO. More... | |
virtual void | SimultaneousMultiply (Element *results, const Element &base, const Integer *exponents, unsigned int exponentsCount) const |
Multiplies a base to multiple exponents in a group. More... | |
Abstract group.
T | element class or type |
const Element&
returned by member functions are references to internal data members. Since each object may have only one such data member for holding results, the following code will produce incorrect results:
abcd = group.Add(group.Add(a,b), group.Add(c,d));
But this should be fine:
abcd = group.Add(a, group.Add(b, group.Add(c,d));
typedef T AbstractGroup< T >::Element |
|
inlinevirtual |
|
pure virtual |
Compare two elements for equality.
a | first element |
b | second element |
Equal() tests the elements for equality using a==b
Implemented in EuclideanDomainOf< T >, EuclideanDomainOf< PolynomialMod2 >, QuotientRing< T >, QuotientRing< EuclideanDomainOf< PolynomialMod2 > >, GF2NP, RingOfPolynomialsOver< T >, GFP2_ONB< F >, ModularArithmetic, EC2N, and ECP.
|
pure virtual |
Provides the Identity element.
Implemented in EuclideanDomainOf< T >, EuclideanDomainOf< PolynomialMod2 >, QuotientRing< T >, QuotientRing< EuclideanDomainOf< PolynomialMod2 > >, EC2N, ECP, ModularArithmetic, RingOfPolynomialsOver< T >, and GFP2_ONB< F >.
|
pure virtual |
Adds elements in the group.
a | first element |
b | second element |
a
and b
Implemented in EuclideanDomainOf< T >, EuclideanDomainOf< PolynomialMod2 >, QuotientRing< T >, QuotientRing< EuclideanDomainOf< PolynomialMod2 > >, RingOfPolynomialsOver< T >, GFP2_ONB< F >, ModularArithmetic, EC2N, and ECP.
|
pure virtual |
Inverts the element in the group.
a | first element |
Implemented in EuclideanDomainOf< T >, EuclideanDomainOf< PolynomialMod2 >, QuotientRing< T >, QuotientRing< EuclideanDomainOf< PolynomialMod2 > >, RingOfPolynomialsOver< T >, GFP2_ONB< F >, ModularArithmetic, EC2N, and ECP.
|
inlinevirtual |
|
virtual |
Doubles an element in the group.
a | the element |
Reimplemented in EuclideanDomainOf< T >, EuclideanDomainOf< PolynomialMod2 >, QuotientRing< T >, QuotientRing< EuclideanDomainOf< PolynomialMod2 > >, RingOfPolynomialsOver< T >, GFP2_ONB< F >, ModularArithmetic, EC2N, and ECP.
Definition at line 15 of file algebra.cpp.
|
virtual |
Subtracts elements in the group.
a | first element |
b | second element |
a
and b
. The element a
must provide a Subtract member function. Reimplemented in EuclideanDomainOf< T >, EuclideanDomainOf< PolynomialMod2 >, QuotientRing< T >, QuotientRing< EuclideanDomainOf< PolynomialMod2 > >, RingOfPolynomialsOver< T >, GFP2_ONB< F >, and ModularArithmetic.
Definition at line 20 of file algebra.cpp.
|
virtual |
TODO.
a | first element |
b | second element |
Reimplemented in EuclideanDomainOf< T >, EuclideanDomainOf< PolynomialMod2 >, QuotientRing< T >, QuotientRing< EuclideanDomainOf< PolynomialMod2 > >, RingOfPolynomialsOver< T >, GFP2_ONB< F >, and ModularArithmetic.
Definition at line 27 of file algebra.cpp.
|
virtual |
Reduces an element in the congruence class.
a | element to reduce |
b | the congruence class |
Reimplemented in EuclideanDomainOf< T >, EuclideanDomainOf< PolynomialMod2 >, QuotientRing< T >, QuotientRing< EuclideanDomainOf< PolynomialMod2 > >, RingOfPolynomialsOver< T >, GFP2_ONB< F >, and ModularArithmetic.
Definition at line 32 of file algebra.cpp.
|
virtual |
Performs a scalar multiplication.
a | multiplicand |
e | multiplier |
Reimplemented in ECP.
Definition at line 90 of file algebra.cpp.
|
virtual |
TODO.
x | first multiplicand |
e1 | the first multiplier |
y | second multiplicand |
e2 | the second multiplier |
Reimplemented in ECP.
Definition at line 97 of file algebra.cpp.
|
virtual |
Multiplies a base to multiple exponents in a group.
results | an array of Elements |
base | the base to raise to the exponents |
exponents | an array of exponents |
exponentsCount | the number of exponents in the array |
SimultaneousMultiply() multiplies the base to each exponent in the exponents array and stores the result at the respective position in the results array.
SimultaneousMultiply() must be implemented in a derived class.
COUNTOF(results) == exponentsCount
COUNTOF(exponents) == exponentsCount
Reimplemented in ECP.
Definition at line 256 of file algebra.cpp.