github.com/jiajun1992/watercarver@v0.0.0-20191031150618-dfc2b17c0c4a/StadiumForWaterCarver/src/Pedersen.h (about)

     1  /*
     2   * Pedersen.h
     3   *
     4   *  Created on: 04.10.2010
     5   *      Author: stephaniebayer
     6   *
     7   * The class contains the public information to commit to vectors or a single value and functions to do this.
     8   *
     9   */
    10  
    11  #ifndef PEDERSEN_H_
    12  #define PEDERSEN_H_
    13  #include<vector>
    14  #include "G_q.h"
    15  #include "FakeZZ.h"
    16  NTL_CLIENT
    17  
    18  #include "Mod_p.h"
    19  
    20  class Pedersen {
    21  private:
    22  	//G_q G; //Group  G_q with order o used for the commitment
    23  	vector<Mod_p>* gen; //vector of generators, public key of the commitment
    24  	vector<vector<CurvePoint>* >* gen_prec;//vector containing the precomputated values of the first two generator for SW algorithm
    25  
    26  	int omega_expo; //window size used for multi-expo.
    27  	int omega_ll; //window size used for multi-expo LL.
    28  	int omega_sw; //window size used for sliding window
    29  public:
    30  	//constructors and destructor
    31  
    32  	void print_commitment(long i) const;
    33  	Pedersen();
    34  	Pedersen(long n);
    35  	Pedersen(Mod_p* g, int n);
    36  	string get_public_vector() const;
    37  	void set_public_vector(istringstream& f, long n, int o1, int o2, int o3);
    38  	virtual ~Pedersen();
    39  
    40  	//functions to access the variables of the class
    41  	G_q get_group() const;
    42  	long get_length()const;
    43  
    44  	void set_omega(int o1, int o2, int o3);
    45  	int get_omega() const;
    46  	vector<Mod_p>* get_gen() const;
    47  
    48  	//Different function to calculate the commitments
    49  	Mod_p commit(ZZ t, ZZ ran);
    50  
    51  	Mod_p commit_opt(const vector<ZZ>* t, ZZ ran);
    52  	Mod_p commit_sw(ZZ t, ZZ ran);
    53  
    54  	//Multi expo functions
    55  	vector<vector<CurvePoint>* >* precomp(CurvePoint g, CurvePoint h);
    56  	long to_long(vector<int>* bit_r);
    57  	void to_long(long& t, vector<int>* bit_r);
    58  	vector<long>* to_basis(ZZ e, long num_b);
    59  	ZZ expo_mult(const vector<ZZ>* e, ZZ ran);
    60  	void expo_mult(ZZ& ret, const vector<ZZ>* e, ZZ ran);
    61  	vector<int>* to_basis_sw(ZZ e, long num_b);
    62  	ZZ multi_expo_sw(ZZ e_1, ZZ e_2);
    63  	void multi_expo_sw(ZZ& ret, ZZ e_1, ZZ e_2);
    64  
    65  
    66  	void operator =(const Pedersen& el);
    67  };
    68  
    69  #endif /* PEDERSEN_H_ */