Line data Source code
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 : // Copyright (c) 2017-2019 The PIVX Core developers 13 : 14 : #include "Params.h" 15 : #include "ParamGeneration.h" 16 : 17 : namespace libzerocoin { 18 : 19 116 : ZerocoinParams::ZerocoinParams(CBigNum N, uint32_t securityLevel) { 20 116 : this->zkp_hash_len = securityLevel; 21 116 : this->zkp_iterations = securityLevel; 22 : 23 116 : this->accumulatorParams.k_prime = ACCPROOF_KPRIME; 24 116 : this->accumulatorParams.k_dprime = ACCPROOF_KDPRIME; 25 : 26 : // Generate the parameters 27 116 : CalculateParams(*this, N, ZEROCOIN_PROTOCOL_VERSION, securityLevel); 28 : 29 116 : this->accumulatorParams.initialized = true; 30 116 : this->initialized = true; 31 116 : } 32 : 33 116 : AccumulatorAndProofParams::AccumulatorAndProofParams() { 34 116 : this->initialized = false; 35 116 : } 36 : 37 812 : IntegerGroupParams::IntegerGroupParams() { 38 812 : this->initialized = false; 39 812 : } 40 : 41 0 : CBigNum IntegerGroupParams::randomElement() const { 42 : // The generator of the group raised 43 : // to a random number less than the order of the group 44 : // provides us with a uniformly distributed random number. 45 0 : return this->g.pow_mod(CBigNum::randBignum(this->groupOrder),this->modulus); 46 : } 47 : 48 : } /* namespace libzerocoin */