-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathParams.cpp
45 lines (36 loc) · 1.21 KB
/
Params.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/**
* @file Params.cpp
*
* @brief Parameter class for Zerocoin.
*
* @author Ian Miers, Christina Garman and Matthew Green
* @date June 2013
*
* @copyright Copyright 2013 Ian Miers, Christina Garman and Matthew Green
* @license This project is released under the MIT license.
**/
#include "Zerocoin.h"
namespace libzerocoin {
Params::Params(Bignum N, uint32_t securityLevel) {
this->zkp_hash_len = securityLevel;
this->zkp_iterations = securityLevel;
this->accumulatorParams.k_prime = ACCPROOF_KPRIME;
this->accumulatorParams.k_dprime = ACCPROOF_KDPRIME;
// Generate the parameters
CalculateParams(*this, N, ZEROCOIN_PROTOCOL_VERSION, securityLevel);
this->accumulatorParams.initialized = true;
this->initialized = true;
}
AccumulatorAndProofParams::AccumulatorAndProofParams() {
this->initialized = false;
}
IntegerGroupParams::IntegerGroupParams() {
this->initialized = false;
}
Bignum IntegerGroupParams::randomElement() const {
// The generator of the group raised
// to a random number less than the order of the group
// provides us with a uniformly distributed random number.
return this->g.pow_mod(Bignum::randBignum(this->groupOrder),this->modulus);
}
} /* namespace libzerocoin */