Models a mathematical multiplicative group. More...
#include <group.hpp>
Public Member Functions | |
Group (mpz_class order, mpz_class gen) | |
Sets the attributes of a new group instance. | |
virtual verifierUtils::ByteTree * | toByteTree () |
Returns the bytetree representation of this group. | |
Element operations | |
virtual Elmt | multiplication (Elmt e1, Elmt e2) |
Returns the product of the two elements as an element of this group. | |
virtual Elmt | multInverse (Elmt e) |
Returns ![]() | |
virtual Elmt | exponentiation (Elmt e, Elmt s) |
Returns the ![]() | |
bool | compare (Elmt e1, Elmt e2) |
Returns true if e1 and e2 have identical values, false otherwise. | |
Array operations | |
ArrayOfElmts | multiplication (ArrayOfElmts e1, ArrayOfElmts e2) |
Returns ![]() | |
ArrayOfElmts | multInverse (ArrayOfElmts e) |
Returns ![]() | |
ArrayOfElmts | exponentiation (ArrayOfElmts e, ArrayOfElmts s) |
Returns ![]() | |
Elmt | product (ArrayOfElmts e) |
Returns ![]() | |
Elmt | expProduct (ArrayOfElmts e, ArrayOfElmts s) |
Returns ![]() | |
bool | compare (ArrayOfElmts e1, ArrayOfElmts e2) |
Returns true if e1 and e2 have identical values component-wise, false if at least one of the component is different. | |
Encoding and decoding elements | |
virtual Elmt | encode (std::vector< uint8_t > message) |
Encodes the message into a element of this group. | |
virtual std::vector< uint8_t > | decode (Elmt e) |
Returns the element encoded in the element given as a paramater. | |
Obtaining element | |
Elmt | getOne () |
Returns an element containing the unit of this group. | |
ArrayOfElmts | getOne (unsigned int n) |
Returns an array containing n copies of the unit of this group. | |
Elmt | getElmt (mpz_class repr) |
Returns the element of this group which has repr as a representative. | |
Elmt | getElmt (verifierUtils::ByteTree *bt) |
Returns the element of this group which bt as a bytetree representation. | |
ArrayOfElmts | getArray (verifierUtils::ByteTree *bt) |
Returns the array of elements of this group which has bt as a bytetree representation. | |
virtual ArrayOfElmts | getRandArray (cryptoTools::PRG *prg, unsigned int nr, unsigned int n0) |
Returns an array of elements of size n0 derived using a prg. | |
Data about the group | |
mpz_class | getMultOrder () |
Returns the multiplicative generator of this group. | |
virtual unsigned int | getLeafSize () |
Returns the byte size the leaves representing element of this group must have. | |
Elmt | getGenerator () |
Returns the multiplicative generator of this group as an element of this group. | |
ArrayOfElmts | getGenerator (unsigned int n) |
Returns an array containing n copies of the multiplicative order of this group. | |
virtual bool | isIn (mpz_class repr) |
Returns true if the element of representative repr is in this group. | |
virtual std::string | getType () |
Returns a string containing the name of this Group. |
Protected Attributes | |
mpz_class | multOrder |
The order of this multiplicative group. | |
mpz_class | generator |
The generator to use for this group. |
Group::Group | ( | mpz_class | order, |
mpz_class | gen | ||
) |
bool Group::compare | ( | ArrayOfElmts | e1, |
ArrayOfElmts | e2 | ||
) |
|
virtual |
|
virtual |
Returns the as an element of this group.
Reimplemented in arithm::PSubGroup, and arithm::ModField.
ArrayOfElmts Group::exponentiation | ( | ArrayOfElmts | e, |
ArrayOfElmts | s | ||
) |
Returns as an array of elements of this group.
Definition at line 88 of file group.cpp.
Elmt Group::expProduct | ( | ArrayOfElmts | e, |
ArrayOfElmts | s | ||
) |
Returns as an element of this group.
Definition at line 116 of file group.cpp.
ArrayOfElmts Group::getArray | ( | verifierUtils::ByteTree * | bt | ) |
Returns the array of elements of this group which has bt as a bytetree representation.
Definition at line 200 of file group.cpp.
Elmt Group::getElmt | ( | mpz_class | repr | ) |
Elmt Group::getElmt | ( | verifierUtils::ByteTree * | bt | ) |
Elmt Group::getGenerator | ( | ) |
ArrayOfElmts Group::getGenerator | ( | unsigned int | n | ) |
Returns an array containing n copies of the multiplicative order of this group.
Definition at line 247 of file group.cpp.
|
virtual |
Returns the byte size the leaves representing element of this group must have.
Reimplemented in arithm::Field, and arithm::PSubGroup.
mpz_class Group::getMultOrder | ( | ) |
Elmt Group::getOne | ( | ) |
ArrayOfElmts Group::getOne | ( | unsigned int | n | ) |
Returns an array containing n copies of the unit of this group.
|
virtual |
Returns an array of elements of size n0 derived using a prg.
prg | The pseudo-random generator to use. |
nr | The statistical distance to use. |
n0 | The size of the array. |
Reimplemented in arithm::ModPGrp.
|
virtual |
Returns a string containing the name of this Group.
Reimplemented in arithm::Field, arithm::PSubGroup, and arithm::ModField.
Definition at line 262 of file group.cpp.
|
virtual |
Returns true if the element of representative repr is in this group.
Reimplemented in arithm::PSubGroup.
Definition at line 256 of file group.cpp.
Returns as an element of this group.
Reimplemented in arithm::PSubGroup, and arithm::ModField.
ArrayOfElmts Group::multInverse | ( | ArrayOfElmts | e | ) |
Returns as an array of elements of this group.
Returns the product of the two elements as an element of this group.
Reimplemented in arithm::PSubGroup, and arithm::ModField.
ArrayOfElmts Group::multiplication | ( | ArrayOfElmts | e1, |
ArrayOfElmts | e2 | ||
) |
Returns as an array of elements of this group.
Definition at line 61 of file group.cpp.
Elmt Group::product | ( | ArrayOfElmts | e | ) |
|
virtual |
Returns the bytetree representation of this group.
Reimplemented in arithm::ModPGrp.
Definition at line 25 of file group.cpp.
|
protected |
|
protected |