PALISADE Lattice Crypto Library  1.11.9
A lattice crypto library for software engineers by software engineers.
bfvrnsB.h
1 // @file bfvrnsB.h -- Operations for the BEHZ variant of BFV.
2 // @author TPOC: contact@palisade-crypto.org
3 //
4 // @copyright Copyright (c) 2019, New Jersey Institute of Technology (NJIT)
5 // All rights reserved.
6 // Redistribution and use in source and binary forms, with or without
7 // modification, are permitted provided that the following conditions are met:
8 // 1. Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer.
10 // 2. Redistributions in binary form must reproduce the above copyright notice,
11 // this list of conditions and the following disclaimer in the documentation
12 // and/or other materials provided with the distribution. THIS SOFTWARE IS
13 // PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
14 // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
15 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
16 // EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
17 // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
20 // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
22 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 
24 /*
25  *
26  * This code implements the BEHZ variant of the Brakerski-Fan-Vercauteren (BFV)
27  *homomorphic encryption scheme. This scheme is also referred to as the FV
28  *scheme.
29  *
30  * The BFV scheme is introduced in the following papers:
31  * - Zvika Brakerski (2012). Fully Homomorphic Encryption without Modulus
32  *Switching from Classical GapSVP. Cryptology ePrint Archive, Report 2012/078.
33  *(https://eprint.iacr.org/2012/078)
34  * - Junfeng Fan and Frederik Vercauteren (2012). Somewhat Practical Fully
35  *Homomorphic Encryption. Cryptology ePrint Archive, Report 2012/144.
36  *(https://eprint.iacr.org/2012/144.pdf)
37  *
38  * Our implementation builds from the designs here:
39  * - Jean-Claude Bajard and Julien Eynard and Anwar Hasan and Vincent
40  *Zucca (2016). A Full RNS Variant of FV like Somewhat Homomorphic Encryption
41  *Schemes. Cryptology ePrint Archive, Report 2016/510.
42  *(https://eprint.iacr.org/2016/510)
43  * - Lepoint T., Naehrig M. (2014) A Comparison of the Homomorphic Encryption
44  *Schemes FV and YASHE. In: Pointcheval D., Vergnaud D. (eds) Progress in
45  *Cryptology – AFRICACRYPT 2014. AFRICACRYPT 2014. Lecture Notes in Computer
46  *Science, vol 8469. Springer, Cham. (https://eprint.iacr.org/2014/062.pdf)
47  * - Ahmad Al Badawi and Yuriy Polyakov and Khin Mi Mi Aung and Bharadwaj
48  *Veeravalli and Kurt Rohloff (2018). Implementation and Performance Evaluation
49  *of RNS Variants of the BFV Homomorphic Encryption Scheme. Cryptology ePrint
50  *Archive, Report 2018/589. {https://eprint.iacr.org/2018/589}
51  *
52  */
53 
54 #ifndef LBCRYPTO_CRYPTO_BFVRNS_B_H
55 #define LBCRYPTO_CRYPTO_BFVRNS_B_H
56 
57 #include <memory>
58 #include <string>
59 #include <vector>
60 
61 #include "palisade.h"
62 
63 namespace lbcrypto {
64 
71 template <class Element>
73  using ParmType = typename Element::Params;
74  using IntType = typename Element::Integer;
75  using DugType = typename Element::DugType;
76  using DggType = typename Element::DggType;
77  using TugType = typename Element::TugType;
78 
79  public:
84 
126  LPCryptoParametersBFVrnsB(shared_ptr<typename Element::Params> params,
127  const PlaintextModulus &plaintextModulus,
128  float distributionParameter, float assuranceMeasure,
129  float securityLevel, usint relinWindow,
130  MODE mode = RLWE, int depth = 1, int maxDepth = 2);
131 
147  LPCryptoParametersBFVrnsB(shared_ptr<typename Element::Params> params,
148  EncodingParams encodingParams,
149  float distributionParameter, float assuranceMeasure,
150  float securityLevel, usint relinWindow,
151  MODE mode = RLWE, int depth = 1, int maxDepth = 2);
152 
168  LPCryptoParametersBFVrnsB(shared_ptr<typename Element::Params> params,
169  EncodingParams encodingParams,
170  float distributionParameter, float assuranceMeasure,
171  SecurityLevel securityLevel, usint relinWindow,
172  MODE mode = RLWE, int depth = 1, int maxDepth = 2);
173 
178 
184  bool PrecomputeCRTTables();
185 
192  bool operator==(const LPCryptoParameters<Element> &rhs) const {
193  const auto *el =
194  dynamic_cast<const LPCryptoParametersBFVrnsB<Element> *>(&rhs);
195 
196  if (el == nullptr) return false;
197 
199  }
200 
201  void PrintParameters(std::ostream &os) const {
203  }
204 
211  const shared_ptr<ILDCRTParams<BigInteger>> GetParamsBsk() const {
212  return m_paramsBsk;
213  }
214 
220  std::vector<NativeInteger> const &GetModuliQ() const { return m_moduliQ; }
221 
227  std::vector<DoubleNativeInt> const &GetModqBarrettMu() const {
228  return m_modqBarrettMu;
229  }
230 
236  std::vector<NativeInteger> const &GetModuliBsk() const { return m_moduliBsk; }
237 
243  std::vector<DoubleNativeInt> const &GetModbskBarrettMu() const {
244  return m_modbskBarrettMu;
245  }
246 
252  const std::vector<NativeInteger> &GetDelta() const { return m_QDivtModq; }
253 
259  std::vector<NativeInteger> const &GetmtildeQHatInvModq() const {
260  return m_mtildeQHatInvModq;
261  }
262 
268  std::vector<NativeInteger> const &GetmtildeQHatInvModqPrecon() const {
269  return m_mtildeQHatInvModqPrecon;
270  }
271 
277  std::vector<std::vector<NativeInteger>> const &GetQHatModbsk() const {
278  return m_QHatModbsk;
279  }
280 
286  std::vector<std::vector<NativeInteger>> const &GetqInvModbsk() const {
287  return m_qInvModbsk;
288  }
289 
295  std::vector<uint16_t> const &GetQHatModmtilde() const {
296  return m_QHatModmtilde;
297  }
298 
304  std::vector<NativeInteger> const &GetQModbsk() const { return m_QModbsk; }
305 
311  std::vector<NativeInteger> const &GetQModbskPrecon() const {
312  return m_QModbskPrecon;
313  }
314 
320  uint16_t const &GetNegQInvModmtilde() const { return m_negQInvModmtilde; }
321 
327  std::vector<NativeInteger> const &GetmtildeInvModbsk() const {
328  return m_mtildeInvModbsk;
329  }
330 
336  std::vector<NativeInteger> const &GetmtildeInvModbskPrecon() const {
337  return m_mtildeInvModbskPrecon;
338  }
339 
345  std::vector<NativeInteger> const &GetQHatInvModq() const {
346  return m_QHatInvModq;
347  }
348 
354  std::vector<NativeInteger> const &GettQHatInvModq() const {
355  return m_tQHatInvModq;
356  }
357 
363  std::vector<NativeInteger> const &GettQHatInvModqPrecon() const {
364  return m_tQHatInvModqPrecon;
365  }
366 
372  std::vector<NativeInteger> const &GettgammaQHatInvModq() const {
373  return m_tgammaQHatInvModq;
374  }
375 
381  std::vector<NativeInteger> const &GettgammaQHatInvModqPrecon() const {
382  return m_tgammaQHatInvModqPrecon;
383  }
384 
390  std::vector<NativeInteger> const &GettQInvModbsk() const {
391  return m_tQInvModbsk;
392  }
393 
399  std::vector<NativeInteger> const &GettQInvModbskPrecon() const {
400  return m_tQInvModbskPrecon;
401  }
402 
408  std::vector<NativeInteger> const &GetBHatInvModb() const {
409  return m_BHatInvModb;
410  }
411 
417  std::vector<NativeInteger> const &GetBHatInvModbPrecon() const {
418  return m_BHatInvModbPrecon;
419  }
420 
426  std::vector<NativeInteger> const &GetBHatModmsk() const {
427  return m_BHatModmsk;
428  }
429 
435  NativeInteger const &GetBInvModmsk() const { return m_BInvModmsk; }
436 
443  return m_BInvModmskPrecon;
444  }
445 
451  std::vector<std::vector<NativeInteger>> const &GetBHatModq() const {
452  return m_BHatModq;
453  }
454 
460  std::vector<NativeInteger> const &GetBModq() const { return m_BModq; }
461 
467  std::vector<NativeInteger> const &GetBModqPrecon() const {
468  return m_BModqPrecon;
469  }
470 
476  uint32_t const &Getgamma() const { return m_gamma; }
477 
478  // TODO: use 64 bit words in case NativeInteger uses smaller word size
484  NativeInteger const &Gettgamma() const { return m_tgamma; }
485 
491  std::vector<NativeInteger> const &GetNegInvqModtgamma() const {
492  return m_negInvqModtgamma;
493  }
494 
500  std::vector<NativeInteger> const &GetNegInvqModtgammaPrecon() const {
501  return m_negInvqModtgammaPrecon;
502  }
503 
504  // NOTE that we do not serialize any of the members declared in this class.
505  // they are all cached computations, and get recomputed in any
506  // implementation that does a deserialization
507  template <class Archive>
508  void save(Archive &ar, std::uint32_t const version) const {
509  ar(::cereal::base_class<LPCryptoParametersRLWE<Element>>(this));
510  }
511 
512  template <class Archive>
513  void load(Archive &ar, std::uint32_t const version) {
514  if (version > SerializedVersion()) {
515  PALISADE_THROW(deserialize_error,
516  "serialized object version " + std::to_string(version) +
517  " is from a later version of the library");
518  }
519  ar(::cereal::base_class<LPCryptoParametersRLWE<Element>>(this));
520  if (SERIALIZE_PRECOMPUTE) {
522  }
523  }
524 
525  std::string SerializedObjectName() const { return "BFVrnsBSchemeParameters"; }
526  static uint32_t SerializedVersion() { return 1; }
527 
528  private:
529  // Stores a precomputed table of [\floor{Q/t}]_{q_i}
530  std::vector<NativeInteger> m_QDivtModq;
531 
532  // Auxiliary CRT basis {Bsk} = {B U msk} = {{b_j} U msk}
533  shared_ptr<ILDCRTParams<BigInteger>> m_paramsBsk;
534 
535  // number of moduli in the base {Q}
536  uint32_t m_numq;
537 
538  // number of moduli in the auxilliary base {B}
539  uint32_t m_numb;
540 
541  // mtilde = 2^16
542  NativeInteger m_mtilde = NativeInteger((uint64_t)1 << 16);
543 
544  // Auxiliary modulus msk
545  NativeInteger m_msk;
546 
547  // Stores q_i
548  std::vector<NativeInteger> m_moduliQ;
549 
550  // Barrett modulo reduction precomputation for q_i
551  std::vector<DoubleNativeInt> m_modqBarrettMu;
552 
553  // Stores auxilliary base moduli b_j
554  std::vector<NativeInteger> m_moduliB;
555 
556  // Stores the roots of unity modulo bsk_j
557  std::vector<NativeInteger> m_rootsBsk;
558 
559  // Stores moduli {bsk_i} = {{b_j} U msk}
560  std::vector<NativeInteger> m_moduliBsk;
561 
562  // Barrett modulo reduction precomputation for bsk_j
563  std::vector<DoubleNativeInt> m_modbskBarrettMu;
564 
565  // Stores [(Q/q_i)^{-1}]_{q_i}
566  std::vector<NativeInteger> m_QHatInvModq;
567 
568  // Stores [t*(Q/q_i)^{-1}]_{q_i}
569  std::vector<NativeInteger> m_tQHatInvModq;
570 
571  // Stores NTL precomputations for [t*(Q/q_i)^{-1}]_{q_i}
572  std::vector<NativeInteger> m_tQHatInvModqPrecon;
573 
574  // Stores [Q/q_i]_{bsk_j}
575  std::vector<std::vector<NativeInteger>> m_QHatModbsk;
576 
577  // Stores [(q_i)^{-1}]_{bsk_j}
578  std::vector<std::vector<NativeInteger>> m_qInvModbsk;
579 
580  // Stores [Q/q_i]_{mtilde}
581  std::vector<uint16_t> m_QHatModmtilde;
582 
583  // Stores [mtilde*(Q/q_i)^{-1}]_{q_i}
584  std::vector<NativeInteger> m_mtildeQHatInvModq;
585 
586  // Stores NTL precomputations for [mtilde*(Q/q_i)^{-1}]_{q_i}
587  std::vector<NativeInteger> m_mtildeQHatInvModqPrecon;
588 
589  // Stores [-Q^{-1}]_{mtilde}
590  uint16_t m_negQInvModmtilde;
591 
592  // Stores [Q]_{bsk_j}
593  std::vector<NativeInteger> m_QModbsk;
594  // Stores NTL precomputations for [Q]_{bsk_j}
595  std::vector<NativeInteger> m_QModbskPrecon;
596 
597  // Stores [mtilde^{-1}]_{bsk_j}
598  std::vector<NativeInteger> m_mtildeInvModbsk;
599  // Stores NTL precomputations for [mtilde^{-1}]_{bsk_j}
600  std::vector<NativeInteger> m_mtildeInvModbskPrecon;
601 
602  // Stores [t/Q]_{bsk_j}
603  std::vector<NativeInteger> m_tQInvModbsk;
604  // Stores NTL precomputations for [t/Q]_{bsk_j}
605  std::vector<NativeInteger> m_tQInvModbskPrecon;
606 
607  // Stores [(B/b_j)^{-1}]_{b_j}
608  std::vector<NativeInteger> m_BHatInvModb;
609  // Stores NTL precomputations for [(B/b_j)^{-1}]_{b_j}
610  std::vector<NativeInteger> m_BHatInvModbPrecon;
611 
612  // Stores [B/b_j]_{q_i}
613  std::vector<std::vector<NativeInteger>> m_BHatModq;
614 
615  // stores [B/b_j]_{msk}
616  std::vector<NativeInteger> m_BHatModmsk;
617 
618  // Stores [B^{-1}]_msk
619  NativeInteger m_BInvModmsk;
620  // Stores NTL precomputations for [B^{-1}]_msk
621  NativeInteger m_BInvModmskPrecon;
622 
623  // Stores [B]_{q_i}
624  std::vector<NativeInteger> m_BModq;
625  // Stores NTL precomputations for [B]_{q_i}
626  std::vector<NativeInteger> m_BModqPrecon;
627 
628  // Stores gamma = 2^26;
629  uint32_t m_gamma = 1 << 26;
630 
631  // TODO: use 64 bit words in case NativeInteger uses smaller word size
632  // Stores t*gamma on a uint64_t word
633  NativeInteger m_tgamma;
634 
635  // Stores [-(q_i)^{-1}]_{t*gamma}
636  std::vector<NativeInteger> m_negInvqModtgamma;
637  // Stores NTL precomputations for [-(q_i)^{-1}]_{t*gamma}
638  std::vector<NativeInteger> m_negInvqModtgammaPrecon;
639 
640  // Stores [t*gamma*(Q/q_i)^(-1)]_{q_i}
641  std::vector<NativeInteger> m_tgammaQHatInvModq;
642  // Stores NTL precomputations for [t*gamma*(Q/q_i)^(-1)]_{q_i}
643  std::vector<NativeInteger> m_tgammaQHatInvModqPrecon;
644 };
645 
652 template <class Element>
654  using ParmType = typename Element::Params;
655  using IntType = typename Element::Integer;
656  using DugType = typename Element::DugType;
657  using DggType = typename Element::DggType;
658  using TugType = typename Element::TugType;
659 
660  public:
665 
681  bool ParamsGen(shared_ptr<LPCryptoParameters<Element>> cryptoParams,
682  int32_t evalAddCount = 0, int32_t evalMultCount = 0,
683  int32_t keySwitchCount = 0, size_t dcrBits = 60,
684  uint32_t n = 0) const override;
685 };
686 
694 template <class Element>
695 class LPAlgorithmBFVrnsB : public LPAlgorithmBFV<Element> {
696  using ParmType = typename Element::Params;
697  using IntType = typename Element::Integer;
698  using DugType = typename Element::DugType;
699  using DggType = typename Element::DggType;
700  using TugType = typename Element::TugType;
701 
702  public:
707 
715  Ciphertext<Element> Encrypt(const LPPublicKey<Element> publicKey,
716  Element plaintext) const override;
717 
725  Ciphertext<Element> Encrypt(const LPPrivateKey<Element> privateKey,
726  Element plaintext) const override;
727 
737  DecryptResult Decrypt(const LPPrivateKey<Element> privateKey,
738  ConstCiphertext<Element> ciphertext,
739  NativePoly *plaintext) const override;
740 };
741 
747 template <class Element>
748 class LPAlgorithmSHEBFVrnsB : public LPAlgorithmSHEBFV<Element> {
749  using ParmType = typename Element::Params;
750  using IntType = typename Element::Integer;
751  using DugType = typename Element::DugType;
752  using DggType = typename Element::DggType;
753  using TugType = typename Element::TugType;
754 
755  public:
760 
768  Ciphertext<Element> EvalAdd(ConstCiphertext<Element> ct,
769  ConstPlaintext pt) const override;
770 
778  Ciphertext<Element> EvalSub(ConstCiphertext<Element> ct,
779  ConstPlaintext pt) const override;
780 
791  Ciphertext<Element> EvalMult(ConstCiphertext<Element> ct1,
792  ConstCiphertext<Element> ct2) const override;
793 
801  LPEvalKey<Element> KeySwitchGen(
802  const LPPrivateKey<Element> oldKey,
803  const LPPrivateKey<Element> newKey) const override;
804 
813  void KeySwitchInPlace(const LPEvalKey<Element> keySwitchHint,
814  Ciphertext<Element>& ciphertext) const override;
815 
829  Ciphertext<Element> EvalMultAndRelinearize(
830  ConstCiphertext<Element> ct1, ConstCiphertext<Element> ct2,
831  const vector<LPEvalKey<Element>> &ek) const override;
832 };
833 
839 template <class Element>
840 class LPAlgorithmPREBFVrnsB : public LPAlgorithmPREBFV<Element> {
841  using ParmType = typename Element::Params;
842  using IntType = typename Element::Integer;
843  using DugType = typename Element::DugType;
844  using DggType = typename Element::DggType;
845  using TugType = typename Element::TugType;
846 
847  public:
852 
879  LPEvalKey<Element> ReKeyGen(
880  const LPPublicKey<Element> newKey,
881  const LPPrivateKey<Element> oldKey) const override;
882 
909  Ciphertext<Element> ReEncrypt(
910  const LPEvalKey<Element> ek, ConstCiphertext<Element> ciphertext,
911  const LPPublicKey<Element> publicKey = nullptr) const override;
912 };
913 
940 template <class Element>
942  using ParmType = typename Element::Params;
943  using IntType = typename Element::Integer;
944  using DugType = typename Element::DugType;
945  using DggType = typename Element::DggType;
946  using TugType = typename Element::TugType;
947 
948  public:
953 
962  DecryptResult MultipartyDecryptFusion(
963  const vector<Ciphertext<Element>> &ciphertextVec,
964  NativePoly *plaintext) const override;
965 
976  LPEvalKey<Element> MultiKeySwitchGen(
977  const LPPrivateKey<Element> oldKey, const LPPrivateKey<Element> newKey,
978  const LPEvalKey<Element> ek) const override;
979 
980  template <class Archive>
981  void save(Archive &ar) const {
982  ar(cereal::base_class<LPAlgorithmMultipartyBFV<Element>>(this));
983  }
984 
985  template <class Archive>
986  void load(Archive &ar) {
987  ar(cereal::base_class<LPAlgorithmMultipartyBFV<Element>>(this));
988  }
989 
990  std::string SerializedObjectName() const { return "BFVrnsBMultiparty"; }
991 };
992 
997 template <class Element>
999  : public LPPublicKeyEncryptionScheme<Element> {
1000  using ParmType = typename Element::Params;
1001  using IntType = typename Element::Integer;
1002  using DugType = typename Element::DugType;
1003  using DggType = typename Element::DggType;
1004  using TugType = typename Element::TugType;
1005 
1006  public:
1008 
1009  bool operator==(
1010  const LPPublicKeyEncryptionScheme<Element> &sch) const override {
1011  return dynamic_cast<const LPPublicKeyEncryptionSchemeBFVrnsB<Element> *>(
1012  &sch) != nullptr;
1013  }
1014 
1015  void Enable(PKESchemeFeature feature) override;
1016 
1017  template <class Archive>
1018  void save(Archive &ar, std::uint32_t const version) const {
1019  ar(::cereal::base_class<LPPublicKeyEncryptionScheme<Element>>(this));
1020  }
1021 
1022  template <class Archive>
1023  void load(Archive &ar, std::uint32_t const version) {
1024  ar(::cereal::base_class<LPPublicKeyEncryptionScheme<Element>>(this));
1025  }
1026 
1027  std::string SerializedObjectName() const override { return "BFVrnsScheme"; }
1028 };
1029 
1030 } // namespace lbcrypto
1031 
1032 #endif
std::vector< NativeInteger > const & GetQModbsk() const
Definition: bfvrnsB.h:304
const shared_ptr< ILDCRTParams< BigInteger > > GetParamsBsk() const
Definition: bfvrnsB.h:211
PRE scheme based on BFV. This functionality is currently DISABLED in LPPublicKeyEncryptionSchemeBFV b...
Definition: bfv.h:749
Decryption result. This represents whether the decryption of a cipheretext was performed correctly...
Definition: pubkeylp.h:105
std::vector< NativeInteger > const & GetBHatModmsk() const
Definition: bfvrnsB.h:426
bool operator==(const LPCryptoParameters< Element > &rhs) const
Definition: bfvrnsB.h:192
std::vector< NativeInteger > const & GetQModbskPrecon() const
Definition: bfvrnsB.h:311
NativeInteger const & GetBInvModmskPrecon() const
Definition: bfvrnsB.h:442
Main public key encryption scheme for BFVrnsB implementation,.
Definition: bfvrnsB.h:998
std::vector< NativeInteger > const & GetModuliQ() const
Definition: bfvrnsB.h:220
std::vector< NativeInteger > const & GettgammaQHatInvModq() const
Definition: bfvrnsB.h:372
Template for crypto parameters.
Definition: rlwe.h:47
LPAlgorithmMultipartyBFVrnsB()
Definition: bfvrnsB.h:952
Concrete class for the FHE Multiparty algorithms on BFV. A version of this multiparty scheme built on...
Definition: bfv.h:860
uint16_t const & GetNegQInvModmtilde() const
Definition: bfvrnsB.h:320
bool operator==(const LPCryptoParameters< Element > &rhs) const
Definition: rlwe.h:284
std::vector< std::vector< NativeInteger > > const & GetQHatModbsk() const
Definition: bfvrnsB.h:277
std::vector< NativeInteger > const & GetmtildeInvModbsk() const
Definition: bfvrnsB.h:327
std::vector< NativeInteger > const & GetBModq() const
Definition: bfvrnsB.h:460
std::vector< NativeInteger > const & GetNegInvqModtgammaPrecon() const
Definition: bfvrnsB.h:500
std::vector< NativeInteger > const & GettQHatInvModqPrecon() const
Definition: bfvrnsB.h:363
NativeInteger const & GetBInvModmsk() const
Definition: bfvrnsB.h:435
std::vector< NativeInteger > const & GettQInvModbsk() const
Definition: bfvrnsB.h:390
Encryption algorithm implementation for BFVrnsB for the basic public key encrypt, decrypt and key gen...
Definition: bfvrnsB.h:695
Definition: exception.h:147
std::vector< NativeInteger > const & GetmtildeQHatInvModqPrecon() const
Definition: bfvrnsB.h:268
std::vector< NativeInteger > const & GetQHatInvModq() const
Definition: bfvrnsB.h:345
std::vector< NativeInteger > const & GettQHatInvModq() const
Definition: bfvrnsB.h:354
std::vector< NativeInteger > const & GetBModqPrecon() const
Definition: bfvrnsB.h:467
This is the parameters class for the BFVrnsB encryption scheme. This scheme is also referred to as th...
Definition: bfvrnsB.h:72
LPCryptoParametersBFVrnsB()
Definition: bfvrnsB.cpp:62
bool SERIALIZE_PRECOMPUTE
Definition: cryptocontext.cpp:30
std::vector< NativeInteger > const & GetBHatInvModb() const
Definition: bfvrnsB.h:408
Parameter generation for BFV. This scheme is also referred to as the FV scheme.
Definition: bfv.h:386
uint32_t const & Getgamma() const
Definition: bfvrnsB.h:476
Encryption algorithm implementation for BFV for the basic public key encrypt, decrypt and key generat...
Definition: bfv.h:439
std::vector< NativeInteger > const & GetmtildeQHatInvModq() const
Definition: bfvrnsB.h:259
std::vector< DoubleNativeInt > const & GetModqBarrettMu() const
Definition: bfvrnsB.h:227
std::vector< NativeInteger > const & GetmtildeInvModbskPrecon() const
Definition: bfvrnsB.h:336
virtual ~LPCryptoParametersBFVrnsB()
Definition: bfvrnsB.h:177
PRE algorithms implementation for BFVrnsB.
Definition: bfvrnsB.h:840
main implementation class to capture essential cryptoparameters of any LBC system ...
Definition: pubkeylp.h:73
std::vector< NativeInteger > const & GettQInvModbskPrecon() const
Definition: bfvrnsB.h:399
LPAlgorithmSHEBFVrnsB()
Definition: bfvrnsB.h:759
Concrete class for the FHE Multiparty algorithms on BFVrnsB. This scheme is also referred to as the F...
Definition: bfvrnsB.h:941
std::vector< std::vector< NativeInteger > > const & GetBHatModq() const
Definition: bfvrnsB.h:451
std::vector< NativeInteger > const & GetBHatInvModbPrecon() const
Definition: bfvrnsB.h:417
std::vector< NativeInteger > const & GetNegInvqModtgamma() const
Definition: bfvrnsB.h:491
const std::vector< NativeInteger > & GetDelta() const
Definition: bfvrnsB.h:252
SHE algorithms implementation for BFVrnsB.
Definition: bfvrnsB.h:748
std::vector< DoubleNativeInt > const & GetModbskBarrettMu() const
Definition: bfvrnsB.h:243
Definition: binfhecontext.h:36
Main class for big integers represented as an array of native (primitive) unsigned integers...
Definition: backend.h:60
SHE algorithms implementation for BFV. This scheme is also referred to as the FV scheme.
Definition: bfv.h:517
std::vector< uint16_t > const & GetQHatModmtilde() const
Definition: bfvrnsB.h:295
Abstract interface for public key encryption schemes.
Definition: pubkeylp.h:3181
std::vector< std::vector< NativeInteger > > const & GetqInvModbsk() const
Definition: bfvrnsB.h:286
LPAlgorithmPREBFVrnsB()
Definition: bfvrnsB.h:851
LPAlgorithmParamsGenBFVrnsB()
Definition: bfvrnsB.h:664
NativeInteger const & Gettgamma() const
Definition: bfvrnsB.h:484
std::vector< NativeInteger > const & GettgammaQHatInvModqPrecon() const
Definition: bfvrnsB.h:381
std::vector< NativeInteger > const & GetModuliBsk() const
Definition: bfvrnsB.h:236
LPAlgorithmBFVrnsB()
Definition: bfvrnsB.h:706
Parameter generation for BFVrnsB. This scheme is also referred to as the FV scheme.
Definition: bfvrnsB.h:653