github.com/jiajun1992/watercarver@v0.0.0-20191031150618-dfc2b17c0c4a/StadiumForWaterCarver/src/Cipher_elg.h (about) 1 /* 2 * Cipher_elg.h 3 * 4 * Created on: 03.10.2010 5 * Author: stephaniebayer 6 * 7 * Class represents a ciphertext generated by ElGammal 8 * No encryption and decryption functionality is provided; this is given by class ElGamal 9 */ 10 11 12 #ifndef CIPHER_ELG_H_ 13 #define CIPHER_ELG_H_ 14 15 16 #include "FakeZZ.h" 17 NTL_CLIENT 18 19 #include "Mod_p.h" 20 #include "CurvePoint.h" 21 22 class Cipher_elg { 23 private: 24 CurvePoint u; 25 ZZ mod; // modular values of the calculations in the cyclic group 26 public: 27 //Constructors & Destructor 28 Cipher_elg(); 29 Cipher_elg(CurvePoint u_val, ZZ mod); 30 Cipher_elg(Mod_p u_t); 31 virtual ~Cipher_elg(); 32 33 // added: explicit initializer 34 Cipher_elg(bool dummy); 35 36 //Access to the parameters 37 CurvePoint get_u() const; 38 ZZ get_mod() const; 39 40 //Operators functionality 41 void operator =(const Cipher_elg& c); 42 Cipher_elg operator *(const Cipher_elg& el)const; 43 bool operator ==(const Cipher_elg& b) const; 44 45 static void mult(Cipher_elg& a, const Cipher_elg& b, const Cipher_elg& c); 46 static void expo(Cipher_elg& e, const Cipher_elg& el, const ZZ expo); 47 48 //Output and Input 49 friend ostream& operator<<(ostream& os, const Cipher_elg el); 50 friend istream& operator >>(istream& is, Cipher_elg& el); 51 52 void print() const; 53 }; 54 55 #endif /* CIPHER_ELG_H_ */