Class FHECKKSRNS
Defined in File ckksrns-fhe.h
Page Contents
Inheritance Relationships
Base Type
public lbcrypto::FHERNS(Class FHERNS)
Class Documentation
-
class lbcrypto::FHECKKSRNS : public lbcrypto::FHERNS
Inheritence diagram for lbcrypto::FHECKKSRNS:
![digraph {
graph [bgcolor="#00000000"]
node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
edge [color="#1414CE"]
"3" [label="lbcrypto::FHEBase< DCRTPoly >" tooltip="lbcrypto::FHEBase< DCRTPoly >"]
"1" [label="lbcrypto::FHECKKSRNS" tooltip="lbcrypto::FHECKKSRNS" fillcolor="#BFBFBF"]
"2" [label="lbcrypto::FHERNS" tooltip="lbcrypto::FHERNS"]
"1" -> "2" [dir=forward tooltip="public-inheritance"]
"2" -> "3" [dir=forward tooltip="public-inheritance"]
}](../_images/graphviz-8a72c844466a0acf6f93f7089a8285c4b4292b82.png)
Collaboration diagram for lbcrypto::FHECKKSRNS:
![digraph {
graph [bgcolor="#00000000"]
node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
edge [color="#1414CE"]
"3" [label="lbcrypto::FHEBase< DCRTPoly >" tooltip="lbcrypto::FHEBase< DCRTPoly >"]
"1" [label="lbcrypto::FHECKKSRNS" tooltip="lbcrypto::FHECKKSRNS" fillcolor="#BFBFBF"]
"2" [label="lbcrypto::FHERNS" tooltip="lbcrypto::FHERNS"]
"1" -> "2" [dir=forward tooltip="public-inheritance"]
"2" -> "3" [dir=forward tooltip="public-inheritance"]
}](../_images/graphviz-8a72c844466a0acf6f93f7089a8285c4b4292b82.png)
Public Functions
-
virtual ~FHECKKSRNS() = default
-
virtual void EvalBootstrapSetup(const CryptoContextImpl<DCRTPoly> &cc, std::vector<uint32_t> levelBudget, std::vector<uint32_t> dim1, uint32_t slots, uint32_t correctionFactor, bool precompute, bool BTSlotsEncoding) override
Bootstrap functionality: There are three methods that have to be called in this specific order:
EvalBootstrapSetup: computes and encodes the coefficients for encoding and decoding and stores the necessary parameters
EvalBootstrapKeyGen: computes and stores the keys for rotations and conjugation
EvalBootstrap: refreshes the given ciphertext Sets all parameters for the linear method for the FFT-like method
- Parameters
levelBudget – - vector of budgets for the amount of levels in encoding and decoding
dim1 – - vector of inner dimension in the baby-step giant-step routine for encoding and decoding
slots – - number of slots to be bootstrapped
correctionFactor – - value to rescale message by to improve precision. If set to 0, we use the default logic. This value is only used when NATIVE_SIZE=64
precompute – - flag specifying whether to precompute the plaintexts for encoding and decoding.
BTSlotsEncoding – - flag specifying whether the approximate modular reduction happens over the message being in slots or coefficients.
-
virtual std::shared_ptr<std::map<uint32_t, EvalKey<DCRTPoly>>> EvalBootstrapKeyGen(const PrivateKey<DCRTPoly> privateKey, uint32_t slots) override
Virtual function to define the generation of all automorphism keys for EvalBT (with FFT evaluation). EvalBTKeyGen uses the baby-step/giant-step strategy.
- Parameters
privateKey – private key.
slots – - number of slots to be bootstrapped
- Returns
the dictionary of evaluation key indices.
-
virtual void EvalBootstrapPrecompute(const CryptoContextImpl<DCRTPoly> &cc, uint32_t slots) override
Computes the plaintexts for encoding and decoding for both linear and FFT-like methods. Supported in CKKS only.
- Parameters
slots – - number of slots to be bootstrapped
-
virtual Ciphertext<DCRTPoly> EvalBootstrap(ConstCiphertext<DCRTPoly> &ciphertext, uint32_t numIterations, uint32_t precision) const override
Defines the bootstrapping evaluation of ciphertext
The flavor of bootstrapping that uses the numIterations and precision parameters is described in the Meta-BTS paper. Source: Bae Y., Cheon J., Cho W., Kim J., and Kim T. META-BTS: Bootstrapping Precision Beyond the Limit. Cryptology ePrint Archive, Report 2022/1167. (https://eprint.iacr.org/2022/1167.pdf)
- Parameters
ciphertext – the input ciphertext.
numIterations – number of iterations to run iterative bootstrapping (Meta-BTS). Increasing the iterations increases the precision of bootstrapping.
precision – precision of initial bootstrapping algorithm. This value is determined by the user experimentally by first running EvalBootstrap with numIterations = 1 and precision = 0 (unused).
- Returns
the refreshed ciphertext.
-
virtual Ciphertext<DCRTPoly> EvalBootstrapStCFirst(ConstCiphertext<DCRTPoly> &ciphertext, uint32_t numIterations, uint32_t precision) const override
-
virtual void EvalFBTSetup(const CryptoContextImpl<DCRTPoly> &cc, const std::vector<std::complex<double>> &coefficients, uint32_t numSlots, const BigInteger &PIn, const BigInteger &POut, const BigInteger &Bigq, const PublicKey<DCRTPoly> &pubKey, const std::vector<uint32_t> &dim1, const std::vector<uint32_t> &levelBudget, uint32_t lvlsAfterBoot = 0, uint32_t depthLeveledComputation = 0, size_t order = 1) override
-
virtual void EvalFBTSetup(const CryptoContextImpl<DCRTPoly> &cc, const std::vector<int64_t> &coefficients, uint32_t numSlots, const BigInteger &PIn, const BigInteger &POut, const BigInteger &Bigq, const PublicKey<DCRTPoly> &pubKey, const std::vector<uint32_t> &dim1, const std::vector<uint32_t> &levelBudget, uint32_t lvlsAfterBoot = 0, uint32_t depthLeveledComputation = 0, size_t order = 1) override
-
virtual Ciphertext<DCRTPoly> EvalFBT(ConstCiphertext<DCRTPoly> &ciphertext, const std::vector<std::complex<double>> &coefficients, uint32_t digitBitSize, const BigInteger &initialScaling, uint64_t postScaling, uint32_t levelToReduce = 0, size_t order = 1) override
-
virtual Ciphertext<DCRTPoly> EvalFBT(ConstCiphertext<DCRTPoly> &ciphertext, const std::vector<int64_t> &coefficients, uint32_t digitBitSize, const BigInteger &initialScaling, uint64_t postScaling, uint32_t levelToReduce = 0, size_t order = 1) override
-
virtual Ciphertext<DCRTPoly> EvalFBTNoDecoding(ConstCiphertext<DCRTPoly> &ciphertext, const std::vector<std::complex<double>> &coefficients, uint32_t digitBitSize, const BigInteger &initialScaling, size_t order = 1) override
-
virtual Ciphertext<DCRTPoly> EvalFBTNoDecoding(ConstCiphertext<DCRTPoly> &ciphertext, const std::vector<int64_t> &coefficients, uint32_t digitBitSize, const BigInteger &initialScaling, size_t order = 1) override
-
virtual Ciphertext<DCRTPoly> EvalHomDecoding(ConstCiphertext<DCRTPoly> &ciphertext, uint64_t postScaling, uint32_t levelToReduce = 0) override
-
virtual std::shared_ptr<seriesPowers<DCRTPoly>> EvalMVBPrecompute(ConstCiphertext<DCRTPoly> &ciphertext, const std::vector<std::complex<double>> &coeffs, uint32_t digitBitSize, const BigInteger &initialScaling, size_t order = 1) override
-
virtual std::shared_ptr<seriesPowers<DCRTPoly>> EvalMVBPrecompute(ConstCiphertext<DCRTPoly> &ciphertext, const std::vector<int64_t> &coeffs, uint32_t digitBitSize, const BigInteger &initialScaling, size_t order = 1) override
-
virtual Ciphertext<DCRTPoly> EvalHermiteTrigSeries(ConstCiphertext<DCRTPoly> &ciphertext, const std::vector<std::complex<double>> &coefficientsCheb, double a, double b, const std::vector<std::complex<double>> &coefficientsHerm, size_t precomp) override
-
virtual Ciphertext<DCRTPoly> EvalHermiteTrigSeries(ConstCiphertext<DCRTPoly> &ciphertext, const std::vector<std::complex<double>> &coefficientsCheb, double a, double b, const std::vector<int64_t> &coefficientsHerm, size_t precomp) override
-
std::vector<ReadOnlyPlaintext> EvalLinearTransformPrecompute(const CryptoContextImpl<DCRTPoly> &cc, const std::vector<std::vector<std::complex<double>>> &A, double scale = 1., uint32_t L = 0) const
-
std::vector<ReadOnlyPlaintext> EvalLinearTransformPrecompute(const CryptoContextImpl<DCRTPoly> &cc, const std::vector<std::vector<std::complex<double>>> &A, const std::vector<std::vector<std::complex<double>>> &B, uint32_t orientation = 0, double scale = 1, uint32_t L = 0) const
-
std::vector<std::vector<ReadOnlyPlaintext>> EvalCoeffsToSlotsPrecompute(const CryptoContextImpl<DCRTPoly> &cc, const std::vector<std::complex<double>> &A, const std::vector<uint32_t> &rotGroup, bool flag_i, double scale = 1, uint32_t L = 0, bool flagStCComplex = false) const
-
std::vector<std::vector<ReadOnlyPlaintext>> EvalSlotsToCoeffsPrecompute(const CryptoContextImpl<DCRTPoly> &cc, const std::vector<std::complex<double>> &A, const std::vector<uint32_t> &rotGroup, bool flag_i, double scale = 1, uint32_t L = 0, bool flagStCComplex = false) const
-
Ciphertext<DCRTPoly> EvalLinearTransform(const std::vector<ReadOnlyPlaintext> &A, ConstCiphertext<DCRTPoly> &ct) const
-
Ciphertext<DCRTPoly> EvalCoeffsToSlots(const std::vector<std::vector<ReadOnlyPlaintext>> &A, ConstCiphertext<DCRTPoly> &ctxt) const
-
Ciphertext<DCRTPoly> EvalSlotsToCoeffs(const std::vector<std::vector<ReadOnlyPlaintext>> &A, ConstCiphertext<DCRTPoly> &ctxt) const
-
inline std::string SerializedObjectName() const
-
inline virtual uint32_t GetCKKSBootCorrectionFactor() const override
-
inline virtual void SetCKKSBootCorrectionFactor(uint32_t cf) override
Public Static Functions
-
static uint32_t GetBootstrapDepth(uint32_t approxModDepth, const std::vector<uint32_t> &levelBudget, SecretKeyDist secretKeyDist)
-
static uint32_t GetBootstrapDepth(const std::vector<uint32_t> &levelBudget, SecretKeyDist secretKeyDist)
-
template<typename VectorDataType>
static uint32_t GetFBTDepth(const std::vector<uint32_t> &levelBudget, const std::vector<VectorDataType> &coefficients, const BigInteger &PInput, size_t order, SecretKeyDist skd)
-
template<typename VectorDataType>
static uint32_t AdjustDepthFBT(const std::vector<VectorDataType> &coefficients, const BigInteger &PInput, size_t order, SecretKeyDist skd = SPARSE_TERNARY)
-
static EvalKey<DCRTPoly> KeySwitchGenSparse(const PrivateKey<DCRTPoly> &oldPrivateKey, const PrivateKey<DCRTPoly> &newPrivateKey)
-
static Ciphertext<DCRTPoly> KeySwitchSparse(Ciphertext<DCRTPoly> &ciphertext, const EvalKey<DCRTPoly> &ek)
-
static Ciphertext<DCRTPoly> EvalMultExt(ConstCiphertext<DCRTPoly> ciphertext, ConstPlaintext plaintext)
-
static void EvalAddExtInPlace(Ciphertext<DCRTPoly> &ciphertext1, ConstCiphertext<DCRTPoly> ciphertext2)
-
static Ciphertext<DCRTPoly> EvalAddExt(ConstCiphertext<DCRTPoly> ciphertext1, ConstCiphertext<DCRTPoly> ciphertext2)
-
static EvalKey<DCRTPoly> ConjugateKeyGen(const PrivateKey<DCRTPoly> privateKey)
-
static Ciphertext<DCRTPoly> Conjugate(ConstCiphertext<DCRTPoly> ciphertext, const std::map<uint32_t, EvalKey<DCRTPoly>> &evalKeys)
-
virtual ~FHECKKSRNS() = default