PIVX Core  5.6.99
P2P Digital Currency
Params.cpp
Go to the documentation of this file.
1 
12 // Copyright (c) 2017-2019 The PIVX Core developers
13 
14 #include "Params.h"
15 #include "ParamGeneration.h"
16 
17 namespace libzerocoin {
18 
19 ZerocoinParams::ZerocoinParams(CBigNum N, uint32_t securityLevel) {
20  this->zkp_hash_len = securityLevel;
21  this->zkp_iterations = securityLevel;
22 
25 
26  // Generate the parameters
27  CalculateParams(*this, N, ZEROCOIN_PROTOCOL_VERSION, securityLevel);
28 
29  this->accumulatorParams.initialized = true;
30  this->initialized = true;
31 }
32 
34  this->initialized = false;
35 }
36 
38  this->initialized = false;
39 }
40 
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  return this->g.pow_mod(CBigNum::randBignum(this->groupOrder),this->modulus);
46 }
47 
48 } /* namespace libzerocoin */
Parameter generation routines for Zerocoin.
#define ACCPROOF_KPRIME
#define ACCPROOF_KDPRIME
#define ZEROCOIN_PROTOCOL_VERSION
C++ wrapper for BIGNUM.
Definition: bignum.h:35
CBigNum pow_mod(const CBigNum &e, const CBigNum &m) const
modular exponentiation: this^e mod n
Definition: bignum.cpp:220
static CBigNum randBignum(const CBigNum &range)
Generates a cryptographically secure random number between zero and range exclusive i....
Definition: bignum.cpp:58
uint32_t k_dprime
Security parameter.
Definition: Params.h:134
uint32_t k_prime
Security parameter.
Definition: Params.h:128
AccumulatorAndProofParams()
Construct a set of Zerocoin parameters from a modulus "N".
Definition: Params.cpp:33
CBigNum randomElement() const
Generates a random group element.
Definition: Params.cpp:41
CBigNum groupOrder
The order of the group.
Definition: Params.h:57
CBigNum modulus
The modulus for the group.
Definition: Params.h:52
CBigNum g
A generator for the group.
Definition: Params.h:40
IntegerGroupParams()
Integer group class, default constructor.
Definition: Params.cpp:37
AccumulatorAndProofParams accumulatorParams
Definition: Params.h:163
uint32_t zkp_hash_len
The amount of the hash function we use for proofs.
Definition: Params.h:189
uint32_t zkp_iterations
The number of iterations to use in the serial number proof.
Definition: Params.h:183
ZerocoinParams(CBigNum accumulatorModulus, uint32_t securityLevel=ZEROCOIN_DEFAULT_SECURITYLEVEL)
Construct a set of Zerocoin parameters from a modulus "N".
Definition: Params.cpp:19
Parameter classes for Zerocoin.
void CalculateParams(ZerocoinParams &params, const CBigNum &N, const std::string &aux, uint32_t securityLevel)
Fill in a set of Zerocoin parameters from a modulus "N".