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