Skip to content

Commit

Permalink
added doxygen comments for new methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuriy Polyakov committed Jun 10, 2024
1 parent f37d2b1 commit e2f0a91
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
17 changes: 17 additions & 0 deletions src/pke/include/schemerns/rns-cryptoparameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,26 @@ class CryptoParametersRNS : public CryptoParametersRLWE<DCRTPoly> {

virtual uint64_t FindAuxPrimeStep() const;

/*
* Estimates the extra modulus bitsize needed for hybrid key swithing (used for finding the minimum secure ring dimension).
*
* @param numPartQ number of digits in hybrid key switching
* @param firstModulusSize bit size of first modulus
* @param dcrtBits bit size for other moduli
* @param extraModulusSize bit size for extra modulus in FLEXIBLEAUTOEXT (CKKS and BGV only)
* @param numPrimes number of moduli witout extraModulus
* @param auxBits size of auxiliar moduli used for hybrid key switching
*
* @return log2 of the modulus and number of RNS limbs.
*/
static std::pair<double, uint32_t> EstimateLogP(uint32_t numPartQ, double firstModulusSize, double dcrtBits,
double extraModulusSize, uint32_t numPrimes, uint32_t auxBits);

/*
* Estimates the extra modulus bitsize needed for threshold FHE noise flooding (only for BGV and BFV)
*
* @return number of extra bits needed for noise flooding
*/
static double EstimateMultipartyFloodingLogQ() {
return NoiseFlooding::MULTIPARTY_MOD_SIZE * NoiseFlooding::NUM_MODULI_MULTIPARTY;
}
Expand Down
3 changes: 1 addition & 2 deletions src/pke/lib/schemerns/rns-cryptoparameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,7 @@ std::pair<double, uint32_t> CryptoParametersRNS::EstimateLogP(uint32_t numPartQ,
uint32_t sizeQ = numPrimes;
if (extraModulusSize > 0)
sizeQ++;
// std::cerr << "sizeQ = " << sizeQ << std::endl;
// std::cerr << "numPartQ = " << numPartQ << std::endl;

// Compute ceil(sizeQ/m_numPartQ), the # of towers per digit
uint32_t numPerPartQ = ceil(static_cast<double>(sizeQ) / numPartQ);
if ((int32_t)(sizeQ - numPerPartQ * (numPartQ - 1)) <= 0) {
Expand Down

0 comments on commit e2f0a91

Please sign in to comment.