github.com/jiajun1992/watercarver@v0.0.0-20191031150618-dfc2b17c0c4a/StadiumForWaterCarver/src/G_q.h (about) 1 /* 2 * G_q.h 3 * 4 * Created on: 30.09.2010 5 * Author: stephaniebayer 6 * 7 * Class describing the group G_q subset of Z_p with prime order q. 8 * 9 */ 10 11 #ifndef G_q_H_ 12 #define G_q_H_ 13 14 #include "Mod_p.h" 15 #include "FakeZZ.h" 16 #include "CurvePoint.h" 17 #include <fstream> 18 NTL_CLIENT 19 20 21 class G_q { 22 private: 23 Mod_p generator; //generator of the group 24 ZZ order; //order of the group 25 ZZ mod; //value of p such that G_q subset of Z_p 26 public: 27 void print() const; 28 29 //Constructors and destructor 30 G_q(); 31 G_q(CurvePoint gen_val, ZZ o , ZZ mod); 32 virtual ~G_q(); 33 34 //Access to the variables 35 Mod_p get_gen() const; 36 ZZ get_ord() const; 37 ZZ get_mod()const; 38 Mod_p map_to_group_element(ZZ& m); 39 //operators 40 void operator =(const G_q& H); 41 friend ostream& operator<<(ostream& os, const G_q& G); 42 43 44 //Test if an element is a generator of the group 45 bool is_generator(const Mod_p& el); 46 47 //returns the identity 48 Mod_p identity(); 49 50 //creates an element with value val 51 Mod_p element(CurvePoint val); 52 Mod_p element(long val); 53 54 //returns the inverse of an value 55 Mod_p inverse(CurvePoint x); 56 Mod_p inverse(long x); 57 }; 58 59 #endif /* G_q_H_ */