123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179 |
- #include "CryptoContext.h"
- #include "openfhe/core/utils/caller_info.h" // CALLER_INFO_ARGS_HDR
- #include "openfhe/pke/gen-cryptocontext.h"
- #include "openfhe/pke/scheme/bfvrns/gen-cryptocontext-bfvrns.h"
- #include "openfhe/pke/scheme/bgvrns/gen-cryptocontext-bgvrns.h"
- #include "openfhe/pke/scheme/ckksrns/gen-cryptocontext-ckksrns.h"
- #include "openfhe/src/lib.rs.h" // ComplexPair
- #include "AssociativeContainerOfOpaqueTypes.h"
- #include "Ciphertext.h"
- #include "CryptoParametersBase.h"
- #include "EncodingParams.h"
- #include "EvalKey.h"
- #include "KeyPair.h"
- #include "LWEPrivateKey.h"
- #include "Plaintext.h"
- #include "PrivateKey.h"
- #include "PublicKey.h"
- #include "SchemeBase.h"
- #include "SequenceContainerOfOpaqueTypes.h"
- namespace openfhe
- {
- using PlaintextImpl = lbcrypto::PlaintextImpl;
- CryptoContextDCRTPoly::CryptoContextDCRTPoly(const ParamsBFVRNS& params)
- : m_cryptoContextImplSharedPtr(lbcrypto::GenCryptoContext(params))
- { }
- CryptoContextDCRTPoly::CryptoContextDCRTPoly(const ParamsBGVRNS& params)
- : m_cryptoContextImplSharedPtr(lbcrypto::GenCryptoContext(params))
- { }
- CryptoContextDCRTPoly::CryptoContextDCRTPoly(const ParamsCKKSRNS& params)
- : m_cryptoContextImplSharedPtr(lbcrypto::GenCryptoContext(params))
- { }
- std::unique_ptr<Plaintext> CryptoContextDCRTPoly::MakeCKKSPackedPlaintextByVectorOfComplex(
- const std::vector<ComplexPair>& value, const size_t scaleDeg, const uint32_t level,
- const std::shared_ptr<DCRTPolyParams> params, const uint32_t slots) const
- {
- std::vector<std::complex<double>> v;
- v.reserve(value.size());
- for (const ComplexPair& elem : value)
- {
- v.emplace_back(elem.re, elem.im);
- }
- return std::make_unique<Plaintext>(m_cryptoContextImplSharedPtr->MakeCKKSPackedPlaintext(v,
- scaleDeg, level, params, slots));
- }
- void CryptoContextDCRTPoly::SetSchemeId(const SCHEME schemeTag) const
- {
- m_cryptoContextImplSharedPtr->setSchemeId(schemeTag);
- }
- SCHEME CryptoContextDCRTPoly::GetSchemeId() const
- {
- return m_cryptoContextImplSharedPtr->getSchemeId();
- }
- size_t CryptoContextDCRTPoly::GetKeyGenLevel() const
- {
- return m_cryptoContextImplSharedPtr->GetKeyGenLevel();
- }
- void CryptoContextDCRTPoly::SetKeyGenLevel(const size_t level) const
- {
- m_cryptoContextImplSharedPtr->SetKeyGenLevel(level);
- }
- void CryptoContextDCRTPoly::SetSwkFC(const CiphertextDCRTPoly& FHEWtoCKKSswk) const
- {
- m_cryptoContextImplSharedPtr->SetSwkFC(FHEWtoCKKSswk.GetInternal());
- }
- void CryptoContextDCRTPoly::EvalCompareSwitchPrecompute(const uint32_t pLWE,
- const double scaleSign, const bool unit) const
- {
- m_cryptoContextImplSharedPtr->EvalCompareSwitchPrecompute(pLWE, scaleSign, unit);
- }
- uint32_t CryptoContextDCRTPoly::FindAutomorphismIndex(const uint32_t idx) const
- {
- return m_cryptoContextImplSharedPtr->FindAutomorphismIndex(idx);
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::GetSwkFC() const
- {
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->GetSwkFC());
- }
- void CryptoContextDCRTPoly::Enable(const PKESchemeFeature feature) const
- {
- m_cryptoContextImplSharedPtr->Enable(feature);
- }
- void CryptoContextDCRTPoly::EnableByMask(const uint32_t featureMask) const
- {
- m_cryptoContextImplSharedPtr->Enable(featureMask);
- }
- std::unique_ptr<KeyPairDCRTPoly> CryptoContextDCRTPoly::KeyGen() const
- {
- return std::make_unique<KeyPairDCRTPoly>(m_cryptoContextImplSharedPtr->KeyGen());
- }
- std::unique_ptr<KeyPairDCRTPoly> CryptoContextDCRTPoly::MultipartyKeyGenByPublicKey(
- const PublicKeyDCRTPoly& publicKey, const bool makeSparse, const bool fresh) const
- {
- return std::make_unique<KeyPairDCRTPoly>(m_cryptoContextImplSharedPtr->MultipartyKeyGen(
- publicKey.GetInternal(), makeSparse, fresh));
- }
- std::unique_ptr<PublicKeyDCRTPoly> CryptoContextDCRTPoly::MultiAddPubKeys(
- const PublicKeyDCRTPoly& publicKey1, const PublicKeyDCRTPoly& publicKey2,
- const std::string& keyId) const
- {
- return std::make_unique<PublicKeyDCRTPoly>(m_cryptoContextImplSharedPtr->MultiAddPubKeys(
- publicKey1.GetInternal(), publicKey2.GetInternal(), keyId));
- }
- std::unique_ptr<KeyPairDCRTPoly> CryptoContextDCRTPoly::SparseKeyGen() const
- {
- return std::make_unique<KeyPairDCRTPoly>(m_cryptoContextImplSharedPtr->SparseKeyGen());
- }
- void CryptoContextDCRTPoly::EvalMultKeyGen(const PrivateKeyDCRTPoly& key) const
- {
- m_cryptoContextImplSharedPtr->EvalMultKeyGen(key.GetInternal());
- }
- void CryptoContextDCRTPoly::EvalMultKeysGen(const PrivateKeyDCRTPoly& key) const
- {
- m_cryptoContextImplSharedPtr->EvalMultKeysGen(key.GetInternal());
- }
- void CryptoContextDCRTPoly::EvalRotateKeyGen(const PrivateKeyDCRTPoly& privateKey,
- const std::vector<int32_t>& indexList, const PublicKeyDCRTPoly& publicKey) const
- {
- m_cryptoContextImplSharedPtr->EvalRotateKeyGen(privateKey.GetInternal(), indexList,
- publicKey.GetInternal());
- }
- void CryptoContextDCRTPoly::EvalAtIndexKeyGen(const PrivateKeyDCRTPoly& privateKey,
- const std::vector<int32_t>& indexList, const PublicKeyDCRTPoly& publicKey) const
- {
- m_cryptoContextImplSharedPtr->EvalAtIndexKeyGen(privateKey.GetInternal(), indexList,
- publicKey.GetInternal());
- }
- void CryptoContextDCRTPoly::EvalCKKStoFHEWPrecompute(const double scale) const
- {
- m_cryptoContextImplSharedPtr->EvalCKKStoFHEWPrecompute(scale);
- }
- std::unique_ptr<Plaintext> CryptoContextDCRTPoly::MakePackedPlaintext(
- const std::vector<int64_t>& value, const size_t noiseScaleDeg,
- const uint32_t level) const
- {
- return std::make_unique<Plaintext>(m_cryptoContextImplSharedPtr->MakePackedPlaintext(value,
- noiseScaleDeg, level));
- }
- std::unique_ptr<Plaintext> CryptoContextDCRTPoly::MakeStringPlaintext(const std::string& s) const
- {
- return std::make_unique<Plaintext>(m_cryptoContextImplSharedPtr->MakeStringPlaintext(s));
- }
- std::unique_ptr<Plaintext> CryptoContextDCRTPoly::MakeCoefPackedPlaintext(
- const std::vector<int64_t>& value, const size_t noiseScaleDeg, const uint32_t level) const
- {
- return std::make_unique<Plaintext>(m_cryptoContextImplSharedPtr->MakeCoefPackedPlaintext(value,
- noiseScaleDeg, level));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EncryptByPublicKey(
- const PublicKeyDCRTPoly& publicKey, const Plaintext& plaintext) const
- {
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->Encrypt(
- publicKey.GetInternal(), plaintext.GetInternal()));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EncryptByPrivateKey(
- const PrivateKeyDCRTPoly& privateKey, const Plaintext& plaintext) const
- {
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->Encrypt(
- privateKey.GetInternal(), plaintext.GetInternal()));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalAddByCiphertexts(
- const CiphertextDCRTPoly& ciphertext1, const CiphertextDCRTPoly& ciphertext2) const
- {
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->EvalAdd(
- ciphertext1.GetInternal(), ciphertext2.GetInternal()));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalAddByCiphertextAndPlaintext(
- const CiphertextDCRTPoly& ciphertext, const Plaintext& plaintext) const
- {
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->EvalAdd(
- ciphertext.GetInternal(), plaintext.GetInternal()));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalAddByPlaintextAndCiphertext(
- const Plaintext& plaintext, const CiphertextDCRTPoly& ciphertext) const
- {
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->EvalAdd(
- plaintext.GetInternal(), ciphertext.GetInternal()));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalAddByConstAndCiphertext(
- const double constant, const CiphertextDCRTPoly& ciphertext) const
- {
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->EvalAdd(
- constant, ciphertext.GetInternal()));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalAddByCiphertextAndConst(
- const CiphertextDCRTPoly& ciphertext, const double constant) const
- {
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->EvalAdd(
- ciphertext.GetInternal(), constant));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalAddMutableByCiphertexts(
- const CiphertextDCRTPoly& ciphertext1, const CiphertextDCRTPoly& ciphertext2) const
- {
- std::shared_ptr<CiphertextImpl> c1 = ciphertext1.GetInternal();
- std::shared_ptr<CiphertextImpl> c2 = ciphertext2.GetInternal();
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->EvalAddMutable(c1,
- c2));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalAddMutableByCiphertextAndPlaintext(
- const CiphertextDCRTPoly& ciphertext, const Plaintext& plaintext) const
- {
- std::shared_ptr<CiphertextImpl> c = ciphertext.GetInternal();
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->EvalAddMutable(c,
- plaintext.GetInternal()));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalAddMutableByPlaintextAndCiphertext(
- const Plaintext& plaintext, const CiphertextDCRTPoly& ciphertext) const
- {
- std::shared_ptr<CiphertextImpl> c = ciphertext.GetInternal();
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->EvalAddMutable(
- plaintext.GetInternal(), c));
- }
- void CryptoContextDCRTPoly::EvalAddInPlaceByCiphertexts(const CiphertextDCRTPoly& ciphertext1,
- const CiphertextDCRTPoly& ciphertext2) const
- {
- std::shared_ptr<CiphertextImpl> c1 = ciphertext1.GetInternal();
- m_cryptoContextImplSharedPtr->EvalAddInPlace(c1, ciphertext2.GetInternal());
- }
- void CryptoContextDCRTPoly::EvalAddInPlaceByCiphertextAndPlaintext(
- const CiphertextDCRTPoly& ciphertext, const Plaintext& plaintext) const
- {
- std::shared_ptr<CiphertextImpl> c = ciphertext.GetInternal();
- m_cryptoContextImplSharedPtr->EvalAddInPlace(c, plaintext.GetInternal());
- }
- void CryptoContextDCRTPoly::EvalAddInPlaceByPlaintextAndCiphertext(const Plaintext& plaintext,
- const CiphertextDCRTPoly& ciphertext) const
- {
- std::shared_ptr<CiphertextImpl> c = ciphertext.GetInternal();
- m_cryptoContextImplSharedPtr->EvalAddInPlace(plaintext.GetInternal(), c);
- }
- void CryptoContextDCRTPoly::EvalAddInPlaceByCiphertextAndConst(
- const CiphertextDCRTPoly& ciphertext, const double constant) const
- {
- std::shared_ptr<CiphertextImpl> c = ciphertext.GetInternal();
- m_cryptoContextImplSharedPtr->EvalAddInPlace(c, constant);
- }
- void CryptoContextDCRTPoly::EvalAddInPlaceByConstAndCiphertext(const double constant,
- const CiphertextDCRTPoly& ciphertext) const
- {
- std::shared_ptr<CiphertextImpl> c = ciphertext.GetInternal();
- m_cryptoContextImplSharedPtr->EvalAddInPlace(constant, c);
- }
- void CryptoContextDCRTPoly::EvalAddMutableInPlace(const CiphertextDCRTPoly& ciphertext1,
- const CiphertextDCRTPoly& ciphertext2) const
- {
- std::shared_ptr<CiphertextImpl> c1 = ciphertext1.GetInternal();
- std::shared_ptr<CiphertextImpl> c2 = ciphertext2.GetInternal();
- m_cryptoContextImplSharedPtr->EvalAddMutableInPlace(c1, c2);
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalSubByCiphertexts(
- const CiphertextDCRTPoly& ciphertext1, const CiphertextDCRTPoly& ciphertext2) const
- {
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->EvalSub(
- ciphertext1.GetInternal(), ciphertext2.GetInternal()));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalSubByCiphertextAndPlaintext(
- const CiphertextDCRTPoly& ciphertext, const Plaintext& plaintext) const
- {
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->EvalSub(
- ciphertext.GetInternal(), plaintext.GetInternal()));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalSubByPlaintextAndCiphertext(
- const Plaintext& plaintext, const CiphertextDCRTPoly& ciphertext) const
- {
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->EvalSub(
- plaintext.GetInternal(), ciphertext.GetInternal()));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalSubByConstAndCiphertext(
- const double constant, const CiphertextDCRTPoly& ciphertext) const
- {
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->EvalSub(
- constant, ciphertext.GetInternal()));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalSubByCiphertextAndConst(
- const CiphertextDCRTPoly& ciphertext, const double constant) const
- {
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->EvalSub(
- ciphertext.GetInternal(), constant));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalSubMutableByCiphertexts(
- const CiphertextDCRTPoly& ciphertext1, const CiphertextDCRTPoly& ciphertext2) const
- {
- std::shared_ptr<CiphertextImpl> c1 = ciphertext1.GetInternal();
- std::shared_ptr<CiphertextImpl> c2 = ciphertext2.GetInternal();
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->EvalSubMutable(c1,
- c2));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalSubMutableByCiphertextAndPlaintext(
- const CiphertextDCRTPoly& ciphertext, const Plaintext& plaintext) const
- {
- std::shared_ptr<CiphertextImpl> c = ciphertext.GetInternal();
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->EvalSubMutable(c,
- plaintext.GetInternal()));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalSubMutableByPlaintextAndCiphertext(
- const Plaintext& plaintext, const CiphertextDCRTPoly& ciphertext) const
- {
- std::shared_ptr<CiphertextImpl> c = ciphertext.GetInternal();
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->EvalSubMutable(
- plaintext.GetInternal(), c));
- }
- void CryptoContextDCRTPoly::EvalSubInPlaceByCiphertexts(const CiphertextDCRTPoly& ciphertext1,
- const CiphertextDCRTPoly& ciphertext2) const
- {
- std::shared_ptr<CiphertextImpl> c1 = ciphertext1.GetInternal();
- m_cryptoContextImplSharedPtr->EvalSubInPlace(c1, ciphertext2.GetInternal());
- }
- void CryptoContextDCRTPoly::EvalSubInPlaceByCiphertextAndConst(
- const CiphertextDCRTPoly& ciphertext, const double constant) const
- {
- std::shared_ptr<CiphertextImpl> c = ciphertext.GetInternal();
- m_cryptoContextImplSharedPtr->EvalSubInPlace(c, constant);
- }
- void CryptoContextDCRTPoly::EvalSubInPlaceByConstAndCiphertext(const double constant,
- const CiphertextDCRTPoly& ciphertext) const
- {
- std::shared_ptr<CiphertextImpl> c = ciphertext.GetInternal();
- m_cryptoContextImplSharedPtr->EvalSubInPlace(constant, c);
- }
- void CryptoContextDCRTPoly::EvalSubMutableInPlace(const CiphertextDCRTPoly& ciphertext1,
- const CiphertextDCRTPoly& ciphertext2) const
- {
- std::shared_ptr<CiphertextImpl> c1 = ciphertext1.GetInternal();
- std::shared_ptr<CiphertextImpl> c2 = ciphertext2.GetInternal();
- m_cryptoContextImplSharedPtr->EvalSubMutableInPlace(c1, c2);
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalMultByCiphertexts(
- const CiphertextDCRTPoly& ciphertext1, const CiphertextDCRTPoly& ciphertext2) const
- {
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->EvalMult(
- ciphertext1.GetInternal(), ciphertext2.GetInternal()));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalMultByCiphertextAndPlaintext(
- const CiphertextDCRTPoly& ciphertext, const Plaintext& plaintext) const
- {
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->EvalMult(
- ciphertext.GetInternal(), plaintext.GetInternal()));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalMultByPlaintextAndCiphertext(
- const Plaintext& plaintext, const CiphertextDCRTPoly& ciphertext) const
- {
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->EvalMult(
- plaintext.GetInternal(), ciphertext.GetInternal()));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalMultByConstAndCiphertext(
- const double constant, const CiphertextDCRTPoly& ciphertext) const
- {
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->EvalMult(
- constant, ciphertext.GetInternal()));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalMultByCiphertextAndConst(
- const CiphertextDCRTPoly& ciphertext, const double constant) const
- {
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->EvalMult(
- ciphertext.GetInternal(), constant));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalMultMutableByCiphertexts(
- const CiphertextDCRTPoly& ciphertext1, const CiphertextDCRTPoly& ciphertext2) const
- {
- std::shared_ptr<CiphertextImpl> c1 = ciphertext1.GetInternal();
- std::shared_ptr<CiphertextImpl> c2 = ciphertext2.GetInternal();
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->EvalMultMutable(c1,
- c2));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalMultMutableByCiphertextAndPlaintext(
- const CiphertextDCRTPoly& ciphertext, const Plaintext& plaintext) const
- {
- std::shared_ptr<CiphertextImpl> c = ciphertext.GetInternal();
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->EvalMultMutable(c,
- plaintext.GetInternal()));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalMultMutableByPlaintextAndCiphertext(
- const Plaintext& plaintext, const CiphertextDCRTPoly& ciphertext) const
- {
- std::shared_ptr<CiphertextImpl> c = ciphertext.GetInternal();
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->EvalMultMutable(
- plaintext.GetInternal(), c));
- }
- void CryptoContextDCRTPoly::EvalMultInPlaceByCiphertextAndConst(
- const CiphertextDCRTPoly& ciphertext, const double constant) const
- {
- std::shared_ptr<CiphertextImpl> c = ciphertext.GetInternal();
- m_cryptoContextImplSharedPtr->EvalMultInPlace(c, constant);
- }
- void CryptoContextDCRTPoly::EvalMultInPlaceByConstAndCiphertext(const double constant,
- const CiphertextDCRTPoly& ciphertext) const
- {
- std::shared_ptr<CiphertextImpl> c = ciphertext.GetInternal();
- m_cryptoContextImplSharedPtr->EvalMultInPlace(constant, c);
- }
- void CryptoContextDCRTPoly::EvalMultMutableInPlace(const CiphertextDCRTPoly& ciphertext1,
- const CiphertextDCRTPoly& ciphertext2) const
- {
- std::shared_ptr<CiphertextImpl> c1 = ciphertext1.GetInternal();
- std::shared_ptr<CiphertextImpl> c2 = ciphertext2.GetInternal();
- m_cryptoContextImplSharedPtr->EvalMultMutableInPlace(c1, c2);
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalMultNoRelin(
- const CiphertextDCRTPoly& ciphertext1, const CiphertextDCRTPoly& ciphertext2) const
- {
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->EvalMultNoRelin(
- ciphertext1.GetInternal(), ciphertext2.GetInternal()));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalMultAndRelinearize(
- const CiphertextDCRTPoly& ciphertext1, const CiphertextDCRTPoly& ciphertext2) const
- {
- return std::make_unique<CiphertextDCRTPoly>(
- m_cryptoContextImplSharedPtr->EvalMultAndRelinearize(ciphertext1.GetInternal(),
- ciphertext2.GetInternal()));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalRotate(
- const CiphertextDCRTPoly& ciphertext, const int32_t index) const
- {
- return std::make_unique<CiphertextDCRTPoly>(
- m_cryptoContextImplSharedPtr->EvalRotate(ciphertext.GetInternal(), index));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalChebyshevSeries(
- const CiphertextDCRTPoly& ciphertext, const std::vector<double>& coefficients,
- const double a, const double b) const
- {
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->EvalChebyshevSeries(
- ciphertext.GetInternal(), coefficients, a, b));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalChebyshevFunction(
- rust::Fn<void(const double x, double& ret)> func, const CiphertextDCRTPoly& ciphertext,
- const double a, const double b, const uint32_t degree) const
- {
- return std::make_unique<CiphertextDCRTPoly>(
- m_cryptoContextImplSharedPtr->EvalChebyshevFunction([&](const double x){
- double result; func(x, result); return result; }, ciphertext.GetInternal(), a, b, degree));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalCompareSchemeSwitching(
- const CiphertextDCRTPoly& ciphertext1, const CiphertextDCRTPoly& ciphertext2,
- const uint32_t numCtxts, const uint32_t numSlots, const uint32_t pLWE, const double scaleSign,
- const bool unit) const
- {
- return std::make_unique<CiphertextDCRTPoly>(
- m_cryptoContextImplSharedPtr->EvalCompareSchemeSwitching(ciphertext1.GetInternal(),
- ciphertext2.GetInternal(), numCtxts, numSlots, pLWE, scaleSign, unit));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::Rescale(
- const CiphertextDCRTPoly& ciphertext) const
- {
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->Rescale(
- ciphertext.GetInternal()));
- }
- void CryptoContextDCRTPoly::RescaleInPlace(const CiphertextDCRTPoly& ciphertext) const
- {
- std::shared_ptr<CiphertextImpl> c = ciphertext.GetInternal();
- m_cryptoContextImplSharedPtr->RescaleInPlace(c);
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::ModReduce(
- const CiphertextDCRTPoly& ciphertext) const
- {
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->ModReduce(
- ciphertext.GetInternal()));
- }
- void CryptoContextDCRTPoly::ModReduceInPlace(const CiphertextDCRTPoly& ciphertext) const
- {
- std::shared_ptr<CiphertextImpl> c = ciphertext.GetInternal();
- m_cryptoContextImplSharedPtr->ModReduceInPlace(c);
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalSum(
- const CiphertextDCRTPoly& ciphertext, const uint32_t batchSize) const
- {
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->EvalSum(
- ciphertext.GetInternal(), batchSize));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalPolyLinear(
- const CiphertextDCRTPoly& ciphertext, const std::vector<double>& coefficients) const
- {
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->EvalPolyLinear(
- ciphertext.GetInternal(), coefficients));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalPolyPS(
- const CiphertextDCRTPoly& ciphertext, const std::vector<double>& coefficients) const
- {
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->EvalPolyPS(
- ciphertext.GetInternal(), coefficients));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalChebyshevSeriesLinear(
- const CiphertextDCRTPoly& ciphertext, const std::vector<double>& coefficients,
- const double a, const double b) const
- {
- return std::make_unique<CiphertextDCRTPoly>(
- m_cryptoContextImplSharedPtr->EvalChebyshevSeriesLinear(ciphertext.GetInternal(),
- coefficients, a, b));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalChebyshevSeriesPS(
- const CiphertextDCRTPoly& ciphertext, const std::vector<double>& coefficients,
- const double a, const double b) const
- {
- return std::make_unique<CiphertextDCRTPoly>(
- m_cryptoContextImplSharedPtr->EvalChebyshevSeriesPS(ciphertext.GetInternal(), coefficients,
- a, b));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalDivide(
- const CiphertextDCRTPoly& ciphertext, const double a, const double b,
- const uint32_t degree) const
- {
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->EvalDivide(
- ciphertext.GetInternal(), a, b, degree));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::IntMPBootAdjustScale(
- const CiphertextDCRTPoly& ciphertext) const
- {
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->IntMPBootAdjustScale(
- ciphertext.GetInternal()));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalLogistic(
- const CiphertextDCRTPoly& ciphertext, const double a, const double b,
- const uint32_t degree) const
- {
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->EvalLogistic(
- ciphertext.GetInternal(), a, b, degree));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::IntMPBootRandomElementGen(
- const PublicKeyDCRTPoly& publicKey) const
- {
- return std::make_unique<CiphertextDCRTPoly>(
- m_cryptoContextImplSharedPtr->IntMPBootRandomElementGen(publicKey.GetInternal()));
- }
- void CryptoContextDCRTPoly::EvalBootstrapSetup(
- const std::vector<uint32_t>& levelBudget, const std::vector<uint32_t>& dim1,
- const uint32_t slots, const uint32_t correctionFactor, const bool precompute) const
- {
- m_cryptoContextImplSharedPtr->EvalBootstrapSetup(levelBudget, dim1, slots, correctionFactor,
- precompute);
- }
- void CryptoContextDCRTPoly::EvalBootstrapKeyGen(const PrivateKeyDCRTPoly& privateKey,
- const uint32_t slots) const
- {
- m_cryptoContextImplSharedPtr->EvalBootstrapKeyGen(privateKey.GetInternal(), slots);
- }
- void CryptoContextDCRTPoly::EvalBootstrapPrecompute(const uint32_t slots) const
- {
- m_cryptoContextImplSharedPtr->EvalBootstrapPrecompute(slots);
- }
- std::unique_ptr<DecryptResult> CryptoContextDCRTPoly::DecryptByPrivateKeyAndCiphertext(
- const PrivateKeyDCRTPoly& privateKey, const CiphertextDCRTPoly& ciphertext,
- Plaintext& plaintext) const
- {
- std::shared_ptr<PlaintextImpl> p;
- std::unique_ptr<DecryptResult> res = std::make_unique<DecryptResult>(
- m_cryptoContextImplSharedPtr->Decrypt(privateKey.GetInternal(), ciphertext.GetInternal(), &p));
- plaintext = p;
- return res;
- }
- std::unique_ptr<DecryptResult> CryptoContextDCRTPoly::DecryptByCiphertextAndPrivateKey(
- const CiphertextDCRTPoly& ciphertext, const PrivateKeyDCRTPoly& privateKey,
- Plaintext& plaintext) const
- {
- std::shared_ptr<PlaintextImpl> p;
- std::unique_ptr<DecryptResult> res = std::make_unique<DecryptResult>(
- m_cryptoContextImplSharedPtr->Decrypt(ciphertext.GetInternal(), privateKey.GetInternal(), &p));
- plaintext = p;
- return res;
- }
- std::unique_ptr<DecryptResult> CryptoContextDCRTPoly::MultipartyDecryptFusion(
- const VectorOfCiphertexts& partialCiphertextVec, Plaintext& plaintext) const
- {
- std::shared_ptr<PlaintextImpl> p;
- std::unique_ptr<DecryptResult> res = std::make_unique<DecryptResult>(
- m_cryptoContextImplSharedPtr->MultipartyDecryptFusion(partialCiphertextVec.GetInternal(), &p));
- plaintext = p;
- return res;
- }
- uint32_t CryptoContextDCRTPoly::GetRingDimension() const
- {
- return m_cryptoContextImplSharedPtr->GetRingDimension();
- }
- uint32_t CryptoContextDCRTPoly::GetCyclotomicOrder() const
- {
- return m_cryptoContextImplSharedPtr->GetCyclotomicOrder();
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalSin(
- const CiphertextDCRTPoly& ciphertext,
- const double a, const double b, const uint32_t degree) const
- {
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->EvalSin(
- ciphertext.GetInternal(), a, b, degree));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalCos(
- const CiphertextDCRTPoly& ciphertext,
- const double a, const double b, const uint32_t degree) const
- {
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->EvalCos(
- ciphertext.GetInternal(), a, b, degree));
- }
- std::unique_ptr<Plaintext> CryptoContextDCRTPoly::MakeCKKSPackedPlaintext(
- const std::vector<double>& value, const size_t scaleDeg, const uint32_t level,
- const std::shared_ptr<DCRTPolyParams> params, const uint32_t slots) const
- {
- return std::make_unique<Plaintext>(m_cryptoContextImplSharedPtr->MakeCKKSPackedPlaintext(
- value, scaleDeg, level, params, slots));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalPoly(
- const CiphertextDCRTPoly& ciphertext, const std::vector<double>& coefficients) const
- {
- return std::make_unique<CiphertextDCRTPoly>(
- m_cryptoContextImplSharedPtr->EvalPoly(ciphertext.GetInternal(), coefficients));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::KeySwitchDown(
- const CiphertextDCRTPoly& ciphertext) const
- {
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->KeySwitchDown(
- ciphertext.GetInternal()));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::KeySwitchExt(
- const CiphertextDCRTPoly& ciphertext, const bool addFirst) const
- {
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->KeySwitchExt(
- ciphertext.GetInternal(), addFirst));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::Compress(
- const CiphertextDCRTPoly& ciphertext, const uint32_t towersLeft) const
- {
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->Compress(
- ciphertext.GetInternal(), towersLeft));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalNegate(
- const CiphertextDCRTPoly& ciphertext) const
- {
- return std::make_unique<CiphertextDCRTPoly>(
- m_cryptoContextImplSharedPtr->EvalNegate(ciphertext.GetInternal()));
- }
- void CryptoContextDCRTPoly::EvalNegateInPlace(const CiphertextDCRTPoly& ciphertext) const
- {
- std::shared_ptr<CiphertextImpl> c = ciphertext.GetInternal();
- m_cryptoContextImplSharedPtr->EvalNegateInPlace(c);
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalSquare(
- const CiphertextDCRTPoly& ciphertext) const
- {
- return std::make_unique<CiphertextDCRTPoly>(
- m_cryptoContextImplSharedPtr->EvalSquare(ciphertext.GetInternal()));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalSquareMutable(
- const CiphertextDCRTPoly& ciphertext) const
- {
- std::shared_ptr<CiphertextImpl> c = ciphertext.GetInternal();
- return std::make_unique<CiphertextDCRTPoly>(
- m_cryptoContextImplSharedPtr->EvalSquareMutable(c));
- }
- void CryptoContextDCRTPoly::EvalSquareInPlace(const CiphertextDCRTPoly& ciphertext) const
- {
- std::shared_ptr<CiphertextImpl> c = ciphertext.GetInternal();
- m_cryptoContextImplSharedPtr->EvalSquareInPlace(c);
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalAtIndex(
- const CiphertextDCRTPoly& ciphertext, const uint32_t index) const
- {
- return std::make_unique<CiphertextDCRTPoly>(
- m_cryptoContextImplSharedPtr->EvalAtIndex(ciphertext.GetInternal(), index));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::ComposedEvalMult(
- const CiphertextDCRTPoly& ciphertext1, const CiphertextDCRTPoly& ciphertext2) const
- {
- return std::make_unique<CiphertextDCRTPoly>(
- m_cryptoContextImplSharedPtr->ComposedEvalMult(ciphertext1.GetInternal(),
- ciphertext2.GetInternal()));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::Relinearize(
- const CiphertextDCRTPoly& ciphertext) const
- {
- return std::make_unique<CiphertextDCRTPoly>(
- m_cryptoContextImplSharedPtr->Relinearize(ciphertext.GetInternal()));
- }
- void CryptoContextDCRTPoly::RelinearizeInPlace(const CiphertextDCRTPoly& ciphertext) const
- {
- std::shared_ptr<CiphertextImpl> c = ciphertext.GetInternal();
- m_cryptoContextImplSharedPtr->RelinearizeInPlace(c);
- }
- std::unique_ptr<std::vector<uint32_t>> CryptoContextDCRTPoly::FindAutomorphismIndices(
- const std::vector<uint32_t>& idxList) const
- {
- return std::make_unique<std::vector<uint32_t>>(
- m_cryptoContextImplSharedPtr->FindAutomorphismIndices(idxList));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalInnerProductByCiphertexts(
- const CiphertextDCRTPoly& ciphertext1, const CiphertextDCRTPoly& ciphertext2,
- const uint32_t batchSize) const
- {
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->EvalInnerProduct(
- ciphertext1.GetInternal(), ciphertext2.GetInternal(), batchSize));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalInnerProductByPlaintext(
- const CiphertextDCRTPoly& ciphertext, const Plaintext& plaintext,
- const uint32_t batchSize) const
- {
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->EvalInnerProduct(
- ciphertext.GetInternal(), plaintext.GetInternal(), batchSize));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::KeySwitch(
- const CiphertextDCRTPoly& ciphertext, const EvalKeyDCRTPoly& evalKey) const
- {
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->KeySwitch(
- ciphertext.GetInternal(), evalKey.GetInternal()));
- }
- void CryptoContextDCRTPoly::KeySwitchInPlace(const CiphertextDCRTPoly& ciphertext,
- const EvalKeyDCRTPoly& evalKey) const
- {
- std::shared_ptr<CiphertextImpl> c = ciphertext.GetInternal();
- m_cryptoContextImplSharedPtr->KeySwitchInPlace(c, evalKey.GetInternal());
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::LevelReduce(
- const CiphertextDCRTPoly& ciphertext, const EvalKeyDCRTPoly& evalKey,
- const size_t levels) const
- {
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->LevelReduce(
- ciphertext.GetInternal(), evalKey.GetInternal(), levels));
- }
- void CryptoContextDCRTPoly::LevelReduceInPlace(const CiphertextDCRTPoly& ciphertext,
- const EvalKeyDCRTPoly& evalKey, const size_t levels) const
- {
- std::shared_ptr<CiphertextImpl> c = ciphertext.GetInternal();
- m_cryptoContextImplSharedPtr->LevelReduceInPlace(c, evalKey.GetInternal(), levels);
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::ReEncrypt(
- const CiphertextDCRTPoly& ciphertext, const EvalKeyDCRTPoly& evalKey,
- const PublicKeyDCRTPoly& publicKey) const
- {
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->ReEncrypt(
- ciphertext.GetInternal(), evalKey.GetInternal(), publicKey.GetInternal()));
- }
- std::unique_ptr<EvalKeyDCRTPoly> CryptoContextDCRTPoly::KeySwitchGen(
- const PrivateKeyDCRTPoly& oldPrivateKey, const PrivateKeyDCRTPoly& newPrivateKey) const
- {
- return std::make_unique<EvalKeyDCRTPoly>(m_cryptoContextImplSharedPtr->KeySwitchGen(
- oldPrivateKey.GetInternal(), newPrivateKey.GetInternal()));
- }
- std::unique_ptr<EvalKeyDCRTPoly> CryptoContextDCRTPoly::ReKeyGen(
- const PrivateKeyDCRTPoly& oldPrivateKey, const PublicKeyDCRTPoly& newPublicKey) const
- {
- return std::make_unique<EvalKeyDCRTPoly>(m_cryptoContextImplSharedPtr->ReKeyGen(
- oldPrivateKey.GetInternal(), newPublicKey.GetInternal()));
- }
- std::unique_ptr<EvalKeyDCRTPoly> CryptoContextDCRTPoly::MultiKeySwitchGen(
- const PrivateKeyDCRTPoly& originalPrivateKey, const PrivateKeyDCRTPoly& newPrivateKey,
- const EvalKeyDCRTPoly& evalKey) const
- {
- return std::make_unique<EvalKeyDCRTPoly>(m_cryptoContextImplSharedPtr->MultiKeySwitchGen(
- originalPrivateKey.GetInternal(), newPrivateKey.GetInternal(), evalKey.GetInternal()));
- }
- std::unique_ptr<EvalKeyDCRTPoly> CryptoContextDCRTPoly::MultiAddEvalKeys(
- const EvalKeyDCRTPoly& evalKey1, const EvalKeyDCRTPoly& evalKey2,
- const std::string& keyId) const
- {
- return std::make_unique<EvalKeyDCRTPoly>(m_cryptoContextImplSharedPtr->MultiAddEvalKeys(
- evalKey1.GetInternal(), evalKey2.GetInternal(), keyId));
- }
- std::unique_ptr<EvalKeyDCRTPoly> CryptoContextDCRTPoly::MultiMultEvalKey(
- const PrivateKeyDCRTPoly& privateKey, const EvalKeyDCRTPoly& evalKey,
- const std::string& keyId) const
- {
- return std::make_unique<EvalKeyDCRTPoly>(m_cryptoContextImplSharedPtr->MultiMultEvalKey(
- privateKey.GetInternal(), evalKey.GetInternal(), keyId));
- }
- std::unique_ptr<EvalKeyDCRTPoly> CryptoContextDCRTPoly::MultiAddEvalMultKeys(
- const EvalKeyDCRTPoly& evalKey1, const EvalKeyDCRTPoly& evalKey2,
- const std::string& keyId) const
- {
- return std::make_unique<EvalKeyDCRTPoly>(m_cryptoContextImplSharedPtr->MultiAddEvalMultKeys(
- evalKey1.GetInternal(), evalKey2.GetInternal(), keyId));
- }
- void CryptoContextDCRTPoly::EvalSumKeyGen(const PrivateKeyDCRTPoly& privateKey,
- const PublicKeyDCRTPoly& publicKey) const
- {
- m_cryptoContextImplSharedPtr->EvalSumKeyGen(privateKey.GetInternal(), publicKey.GetInternal());
- }
- void CryptoContextDCRTPoly::EvalCKKStoFHEWKeyGen(const KeyPairDCRTPoly& keyPair,
- const LWEPrivateKey& lwesk) const
- {
- m_cryptoContextImplSharedPtr->EvalCKKStoFHEWKeyGen({keyPair.GetPublicKey()->GetInternal(),
- keyPair.GetPrivateKey()->GetInternal()}, lwesk.GetInternal());
- }
- void CryptoContextDCRTPoly::EvalFHEWtoCKKSKeyGen(const KeyPairDCRTPoly& keyPair,
- const LWEPrivateKey& lwesk, const uint32_t numSlots, const uint32_t numCtxts,
- const uint32_t dim1, const uint32_t L) const
- {
- m_cryptoContextImplSharedPtr->EvalFHEWtoCKKSKeyGen({keyPair.GetPublicKey()->GetInternal(),
- keyPair.GetPrivateKey()->GetInternal()}, lwesk.GetInternal(), numSlots, numCtxts, dim1, L);
- }
- void CryptoContextDCRTPoly::EvalSchemeSwitchingKeyGen(const KeyPairDCRTPoly& keyPair,
- const LWEPrivateKey& lwesk) const
- {
- m_cryptoContextImplSharedPtr->EvalSchemeSwitchingKeyGen({keyPair.GetPublicKey()->GetInternal(),
- keyPair.GetPrivateKey()->GetInternal()}, lwesk.GetInternal());
- }
- uint64_t CryptoContextDCRTPoly::GetModulus() const
- {
- return m_cryptoContextImplSharedPtr->GetModulus().ConvertToInt();
- }
- uint64_t CryptoContextDCRTPoly::GetRootOfUnity() const
- {
- return m_cryptoContextImplSharedPtr->GetRootOfUnity().ConvertToInt();
- }
- std::unique_ptr<VectorOfCiphertexts> CryptoContextDCRTPoly::MultipartyDecryptLead(
- const VectorOfCiphertexts& ciphertextVec, const PrivateKeyDCRTPoly& privateKey) const
- {
- return std::make_unique<VectorOfCiphertexts>(
- m_cryptoContextImplSharedPtr->MultipartyDecryptLead(ciphertextVec.GetInternal(),
- privateKey.GetInternal()));
- }
- std::unique_ptr<VectorOfCiphertexts> CryptoContextDCRTPoly::MultipartyDecryptMain(
- const VectorOfCiphertexts& ciphertextVec, const PrivateKeyDCRTPoly& privateKey) const
- {
- return std::make_unique<VectorOfCiphertexts>(
- m_cryptoContextImplSharedPtr->MultipartyDecryptMain(ciphertextVec.GetInternal(),
- privateKey.GetInternal()));
- }
- std::unique_ptr<VectorOfCiphertexts> CryptoContextDCRTPoly::IntMPBootDecrypt(
- const PrivateKeyDCRTPoly& privateKey, const CiphertextDCRTPoly& ciphertext,
- const CiphertextDCRTPoly& a) const
- {
- return std::make_unique<VectorOfCiphertexts>(m_cryptoContextImplSharedPtr->IntMPBootDecrypt(
- privateKey.GetInternal(), ciphertext.GetInternal(), a.GetInternal()));
- }
- std::unique_ptr<VectorOfCiphertexts> CryptoContextDCRTPoly::EvalMinSchemeSwitching(
- const CiphertextDCRTPoly& ciphertext, const PublicKeyDCRTPoly& publicKey,
- const uint32_t numValues, const uint32_t numSlots, const uint32_t pLWE,
- const double scaleSign) const
- {
- return std::make_unique<VectorOfCiphertexts>(
- m_cryptoContextImplSharedPtr->EvalMinSchemeSwitching(ciphertext.GetInternal(),
- publicKey.GetInternal(), numValues, numSlots, pLWE, scaleSign));
- }
- std::unique_ptr<VectorOfCiphertexts> CryptoContextDCRTPoly::EvalMinSchemeSwitchingAlt(
- const CiphertextDCRTPoly& ciphertext, const PublicKeyDCRTPoly& publicKey,
- const uint32_t numValues, const uint32_t numSlots, const uint32_t pLWE,
- const double scaleSign) const
- {
- return std::make_unique<VectorOfCiphertexts>(
- m_cryptoContextImplSharedPtr->EvalMinSchemeSwitchingAlt(ciphertext.GetInternal(),
- publicKey.GetInternal(), numValues, numSlots, pLWE, scaleSign));
- }
- std::unique_ptr<VectorOfCiphertexts> CryptoContextDCRTPoly::EvalMaxSchemeSwitching(
- const CiphertextDCRTPoly& ciphertext, const PublicKeyDCRTPoly& publicKey,
- const uint32_t numValues, const uint32_t numSlots, const uint32_t pLWE,
- const double scaleSign) const
- {
- return std::make_unique<VectorOfCiphertexts>(
- m_cryptoContextImplSharedPtr->EvalMaxSchemeSwitching(ciphertext.GetInternal(),
- publicKey.GetInternal(), numValues, numSlots, pLWE, scaleSign));
- }
- std::unique_ptr<VectorOfCiphertexts> CryptoContextDCRTPoly::EvalMaxSchemeSwitchingAlt(
- const CiphertextDCRTPoly& ciphertext, const PublicKeyDCRTPoly& publicKey,
- const uint32_t numValues, const uint32_t numSlots, const uint32_t pLWE,
- const double scaleSign) const
- {
- return std::make_unique<VectorOfCiphertexts>(
- m_cryptoContextImplSharedPtr->EvalMaxSchemeSwitchingAlt(ciphertext.GetInternal(),
- publicKey.GetInternal(), numValues, numSlots, pLWE, scaleSign));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalAddMany(
- const VectorOfCiphertexts& ciphertextVec) const
- {
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->EvalAddMany(
- ciphertextVec.GetInternal()));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalMultMany(
- const VectorOfCiphertexts& ciphertextVec) const
- {
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->EvalMultMany(
- ciphertextVec.GetInternal()));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalMerge(
- const VectorOfCiphertexts& ciphertextVec) const
- {
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->EvalMerge(
- ciphertextVec.GetInternal()));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::IntMPBootEncrypt(
- const PublicKeyDCRTPoly& publicKey, const VectorOfCiphertexts& sharesPair,
- const CiphertextDCRTPoly& a, const CiphertextDCRTPoly& ciphertext) const
- {
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->IntMPBootEncrypt(
- publicKey.GetInternal(), sharesPair.GetInternal(), a.GetInternal(),
- ciphertext.GetInternal()));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalAddManyInPlace(
- VectorOfCiphertexts& ciphertextVec) const
- {
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->EvalAddManyInPlace(
- ciphertextVec.GetInternal()));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalLinearWSumMutable(
- VectorOfCiphertexts& ciphertextVec, const std::vector<double>& constantsVec) const
- {
- return std::make_unique<CiphertextDCRTPoly>(
- m_cryptoContextImplSharedPtr->EvalLinearWSumMutable(ciphertextVec.GetInternal(),
- constantsVec));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalLinearWSumMutable(
- const std::vector<double>& constantsVec, VectorOfCiphertexts& ciphertextVec) const
- {
- return std::make_unique<CiphertextDCRTPoly>(
- m_cryptoContextImplSharedPtr->EvalLinearWSumMutable(constantsVec,
- ciphertextVec.GetInternal()));
- }
- std::unique_ptr<KeyPairDCRTPoly> CryptoContextDCRTPoly::MultipartyKeyGenByVectorOfPrivateKeys(
- const VectorOfPrivateKeys& privateKeyVec) const
- {
- return std::make_unique<KeyPairDCRTPoly>(m_cryptoContextImplSharedPtr->MultipartyKeyGen(
- privateKeyVec.GetInternal()));
- }
- std::unique_ptr<UnorderedMapFromIndexToDCRTPoly> CryptoContextDCRTPoly::ShareKeys(
- const PrivateKeyDCRTPoly& sk, const uint32_t N, const uint32_t threshold, const uint32_t index,
- const std::string& shareType) const
- {
- return std::make_unique<UnorderedMapFromIndexToDCRTPoly>(
- m_cryptoContextImplSharedPtr->ShareKeys(sk.GetInternal(), N, threshold, index, shareType));
- }
- void CryptoContextDCRTPoly::RecoverSharedKey(PrivateKeyDCRTPoly& sk,
- UnorderedMapFromIndexToDCRTPoly& sk_shares, const uint32_t N, const uint32_t threshold,
- const std::string& shareType) const
- {
- std::shared_ptr<PrivateKeyImpl> p = sk.GetInternal();
- m_cryptoContextImplSharedPtr->RecoverSharedKey(p, sk_shares.GetInternal(), N,
- threshold, shareType);
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalAutomorphism(
- const CiphertextDCRTPoly& ciphertext, const uint32_t i,
- const MapFromIndexToEvalKey& evalKeyMap) const
- {
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->EvalAutomorphism(
- ciphertext.GetInternal(), i, evalKeyMap.GetInternalMap()));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalSumRows(
- const CiphertextDCRTPoly& ciphertext, const uint32_t rowSize,
- const MapFromIndexToEvalKey& evalSumKeyMap, const uint32_t subringDim) const
- {
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->EvalSumRows(
- ciphertext.GetInternal(), rowSize, evalSumKeyMap.GetInternalMap(), subringDim));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalSumCols(
- const CiphertextDCRTPoly& ciphertext, const uint32_t rowSize,
- const MapFromIndexToEvalKey& evalSumKeyMap) const
- {
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->EvalSumCols(
- ciphertext.GetInternal(), rowSize, evalSumKeyMap.GetInternalMap()));
- }
- std::unique_ptr<MapFromIndexToEvalKey> CryptoContextDCRTPoly::EvalAutomorphismKeyGen(
- const PrivateKeyDCRTPoly& privateKey, const std::vector<uint32_t>& indexList) const
- {
- return std::make_unique<MapFromIndexToEvalKey>(
- m_cryptoContextImplSharedPtr->EvalAutomorphismKeyGen(privateKey.GetInternal(), indexList));
- }
- std::unique_ptr<MapFromIndexToEvalKey> CryptoContextDCRTPoly::EvalSumRowsKeyGen(
- const PrivateKeyDCRTPoly& privateKey, const PublicKeyDCRTPoly& publicKey,
- const uint32_t rowSize, const uint32_t subringDim) const
- {
- return std::make_unique<MapFromIndexToEvalKey>(m_cryptoContextImplSharedPtr->EvalSumRowsKeyGen(
- privateKey.GetInternal(), publicKey.GetInternal(), rowSize, subringDim));
- }
- std::unique_ptr<MapFromIndexToEvalKey> CryptoContextDCRTPoly::EvalSumColsKeyGen(
- const PrivateKeyDCRTPoly& privateKey, const PublicKeyDCRTPoly& publicKey) const
- {
- return std::make_unique<MapFromIndexToEvalKey>(m_cryptoContextImplSharedPtr->EvalSumColsKeyGen(
- privateKey.GetInternal(), publicKey.GetInternal()));
- }
- std::unique_ptr<MapFromIndexToEvalKey> CryptoContextDCRTPoly::MultiEvalAutomorphismKeyGen(
- const PrivateKeyDCRTPoly& privateKey, const MapFromIndexToEvalKey& evalKeyMap,
- const std::vector<uint32_t>& indexList, const std::string& keyId) const
- {
- return std::make_unique<MapFromIndexToEvalKey>(
- m_cryptoContextImplSharedPtr->MultiEvalAutomorphismKeyGen(privateKey.GetInternal(),
- evalKeyMap.GetInternal(), indexList, keyId));
- }
- std::unique_ptr<MapFromIndexToEvalKey> CryptoContextDCRTPoly::MultiEvalAtIndexKeyGen(
- const PrivateKeyDCRTPoly& privateKey, const MapFromIndexToEvalKey& evalKeyMap,
- const std::vector<int32_t>& indexList, const std::string& keyId) const
- {
- return std::make_unique<MapFromIndexToEvalKey>(
- m_cryptoContextImplSharedPtr->MultiEvalAtIndexKeyGen(privateKey.GetInternal(),
- evalKeyMap.GetInternal(), indexList, keyId));
- }
- std::unique_ptr<MapFromIndexToEvalKey> CryptoContextDCRTPoly::MultiEvalSumKeyGen(
- const PrivateKeyDCRTPoly& privateKey, const MapFromIndexToEvalKey& evalKeyMap,
- const std::string& keyId) const
- {
- return std::make_unique<MapFromIndexToEvalKey>(
- m_cryptoContextImplSharedPtr->MultiEvalSumKeyGen(privateKey.GetInternal(),
- evalKeyMap.GetInternal(), keyId));
- }
- std::unique_ptr<MapFromIndexToEvalKey> CryptoContextDCRTPoly::MultiAddEvalSumKeys(
- const MapFromIndexToEvalKey& evalKeyMap1, const MapFromIndexToEvalKey& evalKeyMap2,
- const std::string& keyId) const
- {
- return std::make_unique<MapFromIndexToEvalKey>(
- m_cryptoContextImplSharedPtr->MultiAddEvalSumKeys(evalKeyMap1.GetInternal(),
- evalKeyMap2.GetInternal(), keyId));
- }
- std::unique_ptr<MapFromIndexToEvalKey> CryptoContextDCRTPoly::MultiAddEvalAutomorphismKeys(
- const MapFromIndexToEvalKey& evalKeyMap1, const MapFromIndexToEvalKey& evalKeyMap2,
- const std::string& keyId) const
- {
- return std::make_unique<MapFromIndexToEvalKey>(
- m_cryptoContextImplSharedPtr->MultiAddEvalAutomorphismKeys(evalKeyMap1.GetInternal(),
- evalKeyMap2.GetInternal(), keyId));
- }
- std::unique_ptr<VectorOfDCRTPolys> CryptoContextDCRTPoly::EvalFastRotationPrecompute(
- const CiphertextDCRTPoly& ciphertext) const
- {
- return std::make_unique<VectorOfDCRTPolys>(
- m_cryptoContextImplSharedPtr->EvalFastRotationPrecompute(ciphertext.GetInternal()));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalFastRotation(
- const CiphertextDCRTPoly& ciphertext, const uint32_t index, const uint32_t m,
- const VectorOfDCRTPolys& digits) const
- {
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->EvalFastRotation(
- ciphertext.GetInternal(), index, m, digits.GetInternal()));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalFastRotationExt(
- const CiphertextDCRTPoly& ciphertext, const uint32_t index, const VectorOfDCRTPolys& digits,
- const bool addFirst) const
- {
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->EvalFastRotationExt(
- ciphertext.GetInternal(), index, digits.GetInternal(), addFirst));
- }
- std::unique_ptr<CiphertextDCRTPoly> CryptoContextDCRTPoly::EvalFHEWtoCKKS(
- VectorOfLWECiphertexts& LWECiphertexts, const uint32_t numCtxts, const uint32_t numSlots,
- const uint32_t p, const double pmin, const double pmax, const uint32_t dim1) const
- {
- return std::make_unique<CiphertextDCRTPoly>(m_cryptoContextImplSharedPtr->EvalFHEWtoCKKS(
- LWECiphertexts.GetInternal(), numCtxts, numSlots, p, pmin, pmax, dim1));
- }
- std::unique_ptr<VectorOfLWECiphertexts> CryptoContextDCRTPoly::EvalCKKStoFHEW(
- const CiphertextDCRTPoly& ciphertext, const uint32_t numCtxts) const
- {
- return std::make_unique<VectorOfLWECiphertexts>(m_cryptoContextImplSharedPtr->EvalCKKStoFHEW(
- ciphertext.GetInternal(), numCtxts));
- }
- std::unique_ptr<VectorOfCiphertexts> CryptoContextDCRTPoly::IntMPBootAdd(
- VectorOfVectorOfCiphertexts& sharesPairVec) const
- {
- return std::make_unique<VectorOfCiphertexts>(m_cryptoContextImplSharedPtr->IntMPBootAdd(
- sharesPairVec.GetInternal()));
- }
- std::unique_ptr<SchemeBaseDCRTPoly> CryptoContextDCRTPoly::GetScheme() const
- {
- return std::make_unique<SchemeBaseDCRTPoly>(m_cryptoContextImplSharedPtr->GetScheme());
- }
- std::unique_ptr<CryptoParametersBaseDCRTPoly> CryptoContextDCRTPoly::GetCryptoParameters() const
- {
- return std::make_unique<CryptoParametersBaseDCRTPoly>(
- m_cryptoContextImplSharedPtr->GetCryptoParameters());
- }
- std::unique_ptr<EncodingParams> CryptoContextDCRTPoly::GetEncodingParams() const
- {
- return std::make_unique<EncodingParams>(m_cryptoContextImplSharedPtr->GetEncodingParams());
- }
- std::shared_ptr<CryptoContextImpl> CryptoContextDCRTPoly::GetInternal() const
- {
- return m_cryptoContextImplSharedPtr;
- }
- // cxx currently does not support static class methods
- void ClearEvalMultKeys()
- {
- CryptoContextImpl::ClearEvalMultKeys();
- }
- void ClearEvalMultKeysById(const std::string& id)
- {
- CryptoContextImpl::ClearEvalMultKeys(id);
- }
- void ClearEvalMultKeysByCryptoContext(const CryptoContextDCRTPoly& cryptoContext)
- {
- CryptoContextImpl::ClearEvalMultKeys(cryptoContext.GetInternal());
- }
- void ClearEvalSumKeys()
- {
- CryptoContextImpl::ClearEvalSumKeys();
- }
- void ClearEvalSumKeysById(const std::string& id)
- {
- CryptoContextImpl::ClearEvalSumKeys(id);
- }
- void ClearEvalSumKeysByCryptoContext(const CryptoContextDCRTPoly& cryptoContext)
- {
- CryptoContextImpl::ClearEvalSumKeys(cryptoContext.GetInternal());
- }
- void ClearEvalAutomorphismKeys()
- {
- CryptoContextImpl::ClearEvalAutomorphismKeys();
- }
- void ClearEvalAutomorphismKeysById(const std::string& id)
- {
- CryptoContextImpl::ClearEvalAutomorphismKeys(id);
- }
- void ClearEvalAutomorphismKeysByCryptoContext(const CryptoContextDCRTPoly& cryptoContext)
- {
- CryptoContextImpl::ClearEvalAutomorphismKeys(cryptoContext.GetInternal());
- }
- std::unique_ptr<std::vector<uint32_t>> GetExistingEvalAutomorphismKeyIndices(
- const std::string& keyTag)
- {
- return std::make_unique<std::vector<uint32_t>>(
- CryptoContextImpl::GetExistingEvalAutomorphismKeyIndices(keyTag));
- }
- std::unique_ptr<std::vector<uint32_t>> GetUniqueValues(const std::vector<uint32_t>& oldValues,
- const std::vector<uint32_t>& newValues)
- {
- return std::make_unique<std::vector<uint32_t>>(CryptoContextImpl::GetUniqueValues(oldValues,
- newValues));
- }
- std::unique_ptr<MapFromIndexToEvalKey> GetEvalAutomorphismKeyMap(const std::string& keyID)
- {
- return std::make_unique<MapFromIndexToEvalKey>(
- CryptoContextImpl::GetEvalAutomorphismKeyMapPtr(keyID));
- }
- std::unique_ptr<MapFromIndexToEvalKey> GetCopyOfEvalSumKeyMap(const std::string& id)
- {
- return std::make_unique<MapFromIndexToEvalKey>(
- std::make_shared<std::map<uint32_t, std::shared_ptr<EvalKeyImpl>>>(
- CryptoContextImpl::GetEvalSumKeyMap(id)));
- }
- std::unique_ptr<MapFromIndexToEvalKey> GetEvalAutomorphismKeyMapPtr(const std::string& keyID)
- {
- return std::make_unique<MapFromIndexToEvalKey>(CryptoContextImpl::GetEvalAutomorphismKeyMapPtr(
- keyID));
- }
- void InsertEvalAutomorphismKey(const MapFromIndexToEvalKey& evalKeyMap, const std::string& keyTag)
- {
- CryptoContextImpl::InsertEvalAutomorphismKey(evalKeyMap.GetInternal(), keyTag);
- }
- void InsertEvalSumKey(const MapFromIndexToEvalKey& mapToInsert, const std::string& keyTag)
- {
- CryptoContextImpl::InsertEvalSumKey(mapToInsert.GetInternal(), keyTag);
- }
- std::unique_ptr<VectorOfEvalKeys> GetCopyOfEvalMultKeyVector(const std::string& keyID)
- {
- return std::make_unique<VectorOfEvalKeys>(CryptoContextImpl::GetEvalMultKeyVector(keyID));
- }
- void InsertEvalMultKey(const VectorOfEvalKeys& evalKeyVec)
- {
- CryptoContextImpl::InsertEvalMultKey(evalKeyVec.GetInternal());
- }
- std::unique_ptr<MapFromStringToVectorOfEvalKeys> GetCopyOfAllEvalMultKeys()
- {
- return std::make_unique<MapFromStringToVectorOfEvalKeys>(
- CryptoContextImpl::GetAllEvalMultKeys());
- }
- std::unique_ptr<MapFromStringToMapFromIndexToEvalKey> GetCopyOfAllEvalSumKeys()
- {
- return std::make_unique<MapFromStringToMapFromIndexToEvalKey>(
- CryptoContextImpl::GetAllEvalSumKeys());
- }
- std::unique_ptr<MapFromStringToMapFromIndexToEvalKey> GetCopyOfAllEvalAutomorphismKeys()
- {
- return std::make_unique<MapFromStringToMapFromIndexToEvalKey>(
- CryptoContextImpl::GetAllEvalAutomorphismKeys());
- }
- // Generator functions
- std::unique_ptr<CryptoContextDCRTPoly> GenNullCryptoContext()
- {
- return std::make_unique<CryptoContextDCRTPoly>();
- }
- std::unique_ptr<CryptoContextDCRTPoly> GenCryptoContextByParamsBFVRNS(const ParamsBFVRNS& params)
- {
- return std::make_unique<CryptoContextDCRTPoly>(params);
- }
- std::unique_ptr<CryptoContextDCRTPoly> GenCryptoContextByParamsBGVRNS(const ParamsBGVRNS& params)
- {
- return std::make_unique<CryptoContextDCRTPoly>(params);
- }
- std::unique_ptr<CryptoContextDCRTPoly> GenCryptoContextByParamsCKKSRNS(const ParamsCKKSRNS& params)
- {
- return std::make_unique<CryptoContextDCRTPoly>(params);
- }
- } // openfhe
|