Kaynağa Gözat

216 standardize binding (#240)

* Multiple changes to bindings, removed some wrappers

* Removed cryptocontext_wrapper.cpp

* binfhe_bindings cleanup

* binfhe_bindings cleanup (2)

---------

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>
dsuponitskiy 7 ay önce
ebeveyn
işleme
052b700b88

+ 0 - 1
CMakeLists.txt

@@ -71,7 +71,6 @@ pybind11_add_module(openfhe
                     src/lib/binfhe_bindings.cpp
                     src/lib/binfhe/binfhecontext_wrapper.cpp
                     src/lib/pke/serialization.cpp 
-                    src/lib/pke/cryptocontext_wrapper.cpp
                     )
 ### Python installation 
 # Allow the user to specify the path to Python executable (if not provided, find it)

+ 2 - 31
src/include/binfhe/binfhecontext_wrapper.h

@@ -31,43 +31,14 @@
 #ifndef __BINFHECONTEXT_WRAPPER_H__
 #define __BINFHECONTEXT_WRAPPER_H__
 
-#include <pybind11/pybind11.h>
-#include <pybind11/stl.h>
-#include "openfhe.h"
 #include "binfhecontext.h"
-#include <functional>
+
+#include <pybind11/pybind11.h>
 #include <pybind11/functional.h>
 
 namespace py = pybind11;
 using namespace lbcrypto;
-LWECiphertext binfhe_EncryptWrapper(BinFHEContext &self,
-                                    ConstLWEPrivateKey sk,
-                                    const LWEPlaintext &m,
-                                    BINFHE_OUTPUT output,
-                                    LWEPlaintextModulus p,
-                                    uint64_t mod);
-LWEPlaintext binfhe_DecryptWrapper(BinFHEContext &self,
-                                   ConstLWEPrivateKey sk,
-                                   ConstLWECiphertext ct,
-                                   LWEPlaintextModulus p);
-
-uint32_t GetnWrapper(BinFHEContext &self);
-
-const uint64_t GetqWrapper(BinFHEContext &self) ;
-
-const uint64_t GetMaxPlaintextSpaceWrapper(BinFHEContext &self);
-
-const uint64_t GetBetaWrapper(BinFHEContext &self);
-
-const uint64_t GetLWECiphertextModulusWrapper(LWECiphertext &self);
 
 std::vector<uint64_t> GenerateLUTviaFunctionWrapper(BinFHEContext &self, py::function f, uint64_t p);
 
-NativeInteger StaticFunction(NativeInteger m, NativeInteger p);
-
-// Define static variables to hold the state
-// extern py::function static_f;
-
-LWECiphertext EvalFuncWrapper(BinFHEContext &self, ConstLWECiphertext &ct, const std::vector<uint64_t> &LUT);
-
 #endif // __BINFHECONTEXT_WRAPPER_H__

+ 0 - 67
src/include/pke/cryptocontext_wrapper.h

@@ -1,67 +0,0 @@
-//==================================================================================
-// BSD 2-Clause License
-//
-// Copyright (c) 2023-2025, Duality Technologies Inc. and other contributors
-//
-// All rights reserved.
-//
-// Author TPOC: contact@openfhe.org
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//==================================================================================
-#ifndef __CRYPTOCONTEXT_WRAPPER_H__
-#define __CRYPTOCONTEXT_WRAPPER_H__
-
-#include "openfhe.h"
-
-using namespace lbcrypto;
-
-
-Ciphertext<DCRTPoly> EvalFastRotationPrecomputeWrapper(CryptoContext<DCRTPoly> &self,
-                                                       ConstCiphertext<DCRTPoly> ciphertext);
-
-Ciphertext<DCRTPoly> EvalFastRotationWrapper(CryptoContext<DCRTPoly> &self,
-                                             ConstCiphertext<DCRTPoly> ciphertext,
-                                             uint32_t index,
-                                             uint32_t m,
-                                             ConstCiphertext<DCRTPoly> digits);
-Ciphertext<DCRTPoly> EvalFastRotationExtWrapper(CryptoContext<DCRTPoly> &self, ConstCiphertext<DCRTPoly> ciphertext, uint32_t index, ConstCiphertext<DCRTPoly> digits, bool addFirst);
-
-Plaintext DecryptWrapper(CryptoContext<DCRTPoly> &self,
-                         ConstCiphertext<DCRTPoly> ciphertext, const PrivateKey<DCRTPoly> privateKey);
-Plaintext DecryptWrapper(CryptoContext<DCRTPoly> &self,
-                         const PrivateKey<DCRTPoly> privateKey, ConstCiphertext<DCRTPoly> ciphertext);
-Plaintext MultipartyDecryptFusionWrapper(CryptoContext<DCRTPoly>& self,const std::vector<Ciphertext<DCRTPoly>>& partialCiphertextVec);
-
-const std::shared_ptr<std::map<uint32_t, EvalKey<DCRTPoly>>> GetEvalSumKeyMapWrapper(CryptoContext<DCRTPoly>& self, const std::string &id);
-PlaintextModulus GetPlaintextModulusWrapper(CryptoContext<DCRTPoly>& self);
-uint32_t GetBatchSizeWrapper(CryptoContext<DCRTPoly>& self);
-double GetModulusWrapper(CryptoContext<DCRTPoly>& self);
-void RemoveElementWrapper(Ciphertext<DCRTPoly>& self, uint32_t index);
-double GetScalingFactorRealWrapper(CryptoContext<DCRTPoly>& self, uint32_t l);
-uint64_t GetModulusCKKSWrapper(CryptoContext<DCRTPoly>& self);
-ScalingTechnique GetScalingTechniqueWrapper(CryptoContext<DCRTPoly>& self);
-uint32_t GetDigitSizeWrapper(CryptoContext<DCRTPoly>& self);
-
-void ClearEvalMultKeysWrapper();
-
-#endif // __CRYPTOCONTEXT_WRAPPER_H__

Dosya farkı çok büyük olduğundan ihmal edildi
+ 665 - 527
src/lib/bindings.cpp


+ 10 - 70
src/lib/binfhe/binfhecontext_wrapper.cpp

@@ -28,97 +28,37 @@
 // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 //==================================================================================
-#include <pybind11/pybind11.h>
-#include <pybind11/stl.h>
 #include <openfhe.h>
 #include "binfhecontext_wrapper.h"
 
+#include <pybind11/pybind11.h>
+#include <pybind11/stl.h>
+
 using namespace lbcrypto;
 namespace py = pybind11;
 
-LWECiphertext binfhe_EncryptWrapper(BinFHEContext &self, ConstLWEPrivateKey sk, const LWEPlaintext &m, BINFHE_OUTPUT output,
-                                    LWEPlaintextModulus p, uint64_t mod)
-{
-    NativeInteger mod_native_int = NativeInteger(mod);
-    return self.Encrypt(sk, m, output, p, mod_native_int);
-}
-
-LWEPlaintext binfhe_DecryptWrapper(BinFHEContext &self,
-                                   ConstLWEPrivateKey sk,
-                                   ConstLWECiphertext ct,
-                                   LWEPlaintextModulus p)
-{
-
-    LWEPlaintext result;
-    self.Decrypt(sk, ct, &result, p);
-    return result;
-}
-
-uint32_t GetnWrapper(BinFHEContext &self)
-{
-    return self.GetParams()->GetLWEParams()->Getn();
-}
-
-const uint64_t GetqWrapper(BinFHEContext &self)
-{
-    return self.GetParams()->GetLWEParams()->Getq().ConvertToInt<uint64_t>();
-}
-
-const uint64_t GetMaxPlaintextSpaceWrapper(BinFHEContext &self)
-{
-    return self.GetMaxPlaintextSpace().ConvertToInt<uint64_t>();
-}
-
-const uint64_t GetBetaWrapper(BinFHEContext &self)
-{
-    return self.GetBeta().ConvertToInt<uint64_t>();
-}
-
-const uint64_t GetLWECiphertextModulusWrapper(LWECiphertext &self)
-{
-    return self->GetModulus().ConvertToInt<uint64_t>();
-}
 
 // Define static variables to hold the state
 py::function* static_f = nullptr;
 
 // Define a static function that uses the static variables
 NativeInteger StaticFunction(NativeInteger m, NativeInteger p) {
-    // Convert the arguments to int
-    uint64_t m_int = m.ConvertToInt<uint64_t>();
-    uint64_t p_int = p.ConvertToInt<uint64_t>();
     // Call the Python function
-    py::object result_py = (*static_f)(m_int, p_int);
+    py::object result_py = (*static_f)(m.ConvertToInt<uint64_t>(), p.ConvertToInt<uint64_t>());
     // Convert the result to a NativeInteger
     return NativeInteger(py::cast<uint64_t>(result_py));
 }
 
-std::vector<uint64_t> GenerateLUTviaFunctionWrapper(BinFHEContext &self, py::function f, uint64_t p)
-{
-    NativeInteger p_native_int = NativeInteger(p);
+std::vector<uint64_t> GenerateLUTviaFunctionWrapper(BinFHEContext &self, py::function f, uint64_t p) {
     static_f = &f;
-    std::vector<NativeInteger> result = self.GenerateLUTviaFunction(StaticFunction, p_native_int);
+    std::vector<NativeInteger> result = self.GenerateLUTviaFunction(StaticFunction, NativeInteger(p));
     static_f = nullptr;
+
     std::vector<uint64_t> result_uint64_t;
-    // int size_int = static_cast<int>(result.size());
+    result.reserve(result.size());
     for (const auto& value : result)
-    {
-        result_uint64_t.push_back(value.ConvertToInt<uint64_t>());
-    }
-    return result_uint64_t;
-}
+        result_uint64_t.emplace_back(value.ConvertToInt<uint64_t>());
 
-// LWECiphertext EvalFunc(ConstLWECiphertext &ct, const std::vector<NativeInteger> &LUT) const
-LWECiphertext EvalFuncWrapper(BinFHEContext &self, ConstLWECiphertext &ct, const std::vector<uint64_t> &LUT)
-{
-    std::vector<NativeInteger> LUT_native_int;
-    LUT_native_int.reserve(LUT.size());  // Reserve space for the elements
-    for (const auto& value : LUT)
-    {
-        LUT_native_int.push_back(NativeInteger(value));
-    }
-    return self.EvalFunc(ct, LUT_native_int);
+    return result_uint64_t;
 }
 
-
-

+ 227 - 180
src/lib/binfhe_bindings.cpp

@@ -30,207 +30,254 @@
 //==================================================================================
 #include "binfhe_bindings.h"
 
-#include <pybind11/operators.h>
-
 #include "openfhe.h"
 #include "binfhecontext.h"
 #include "binfhecontext_docs.h"
 #include "binfhecontext_wrapper.h"
 
+#include <pybind11/stl.h>
+#include <pybind11/operators.h>
+
 #include "cereal/archives/binary.hpp"
-// #include "cereal/archives/portable_binary.hpp"
-// #include "core/utils/serial.h"
 
 using namespace lbcrypto;
 namespace py = pybind11;
 
 void bind_binfhe_enums(py::module &m) {
-  py::enum_<BINFHE_PARAMSET>(m, "BINFHE_PARAMSET")
-      .value("TOY", BINFHE_PARAMSET::TOY)
-      .value("MEDIUM", BINFHE_PARAMSET::MEDIUM)
-      .value("STD128_LMKCDEY", BINFHE_PARAMSET::STD128_LMKCDEY)
-      .value("STD128_AP", BINFHE_PARAMSET::STD128_AP)
-      .value("STD128", BINFHE_PARAMSET::STD128)
-      .value("STD192", BINFHE_PARAMSET::STD192)
-      .value("STD256", BINFHE_PARAMSET::STD256)
-      .value("STD128Q", BINFHE_PARAMSET::STD128Q)
-      .value("STD128Q_LMKCDEY", BINFHE_PARAMSET::STD128Q_LMKCDEY)
-      .value("STD192Q", BINFHE_PARAMSET::STD192Q)
-      .value("STD256Q", BINFHE_PARAMSET::STD256Q)
-      .value("STD128_3", BINFHE_PARAMSET::STD128_3)
-      .value("STD128_3_LMKCDEY", BINFHE_PARAMSET::STD128_3_LMKCDEY)
-      .value("STD128Q_3", BINFHE_PARAMSET::STD128Q_3)
-      .value("STD128Q_3_LMKCDEY", BINFHE_PARAMSET::STD128Q_3_LMKCDEY)
-      .value("STD192Q_3", BINFHE_PARAMSET::STD192Q_3)
-      .value("STD256Q_3", BINFHE_PARAMSET::STD256Q_3)
-      .value("STD128_4", BINFHE_PARAMSET::STD128_4)
-      .value("STD128_4_LMKCDEY", BINFHE_PARAMSET::STD128_4_LMKCDEY)
-      .value("STD128Q_4", BINFHE_PARAMSET::STD128Q_4)
-      .value("STD128Q_4_LMKCDEY", BINFHE_PARAMSET::STD128Q_4_LMKCDEY)
-      .value("STD192Q_4", BINFHE_PARAMSET::STD192Q_4)
-      .value("STD256Q_4", BINFHE_PARAMSET::STD256Q_4)
-      .value("SIGNED_MOD_TEST", BINFHE_PARAMSET::SIGNED_MOD_TEST);
-  m.attr("TOY") = py::cast(BINFHE_PARAMSET::TOY);
-  m.attr("MEDIUM") = py::cast(BINFHE_PARAMSET::MEDIUM);
-  m.attr("STD128_LMKCDEY") = py::cast(BINFHE_PARAMSET::STD128_LMKCDEY);
-  m.attr("STD128_AP") = py::cast(BINFHE_PARAMSET::STD128_AP);
-  m.attr("STD128") = py::cast(BINFHE_PARAMSET::STD128);
-  m.attr("STD192") = py::cast(BINFHE_PARAMSET::STD192);
-  m.attr("STD256") = py::cast(BINFHE_PARAMSET::STD256);
-  m.attr("STD128Q") = py::cast(BINFHE_PARAMSET::STD128Q);
-  m.attr("STD128Q_LMKCDEY") = py::cast(BINFHE_PARAMSET::STD128Q_LMKCDEY);
-  m.attr("STD192Q") = py::cast(BINFHE_PARAMSET::STD192Q);
-  m.attr("STD256Q") = py::cast(BINFHE_PARAMSET::STD256Q);
-  m.attr("STD128_3") = py::cast(BINFHE_PARAMSET::STD128_3);
-  m.attr("STD128_3_LMKCDEY") = py::cast(BINFHE_PARAMSET::STD128_3_LMKCDEY);
-  m.attr("STD128Q_3") = py::cast(BINFHE_PARAMSET::STD128Q_3);
-  m.attr("STD128Q_3_LMKCDEY") = py::cast(BINFHE_PARAMSET::STD128Q_3_LMKCDEY);
-  m.attr("STD192Q_3") = py::cast(BINFHE_PARAMSET::STD192Q_3);
-  m.attr("STD256Q_3") = py::cast(BINFHE_PARAMSET::STD256Q_3);
-  m.attr("STD128_4") = py::cast(BINFHE_PARAMSET::STD128_4);
-  m.attr("STD128_4_LMKCDEY") = py::cast(BINFHE_PARAMSET::STD128_4_LMKCDEY);
-  m.attr("STD128Q_4") = py::cast(BINFHE_PARAMSET::STD128Q_4);
-  m.attr("STD128Q_4_LMKCDEY") = py::cast(BINFHE_PARAMSET::STD128Q_4_LMKCDEY);
-  m.attr("STD192Q_4") = py::cast(BINFHE_PARAMSET::STD192Q_4);
-  m.attr("STD256Q_4") = py::cast(BINFHE_PARAMSET::STD256Q_4);
-  m.attr("SIGNED_MOD_TEST") = py::cast(BINFHE_PARAMSET::SIGNED_MOD_TEST);
+     py::enum_<BINFHE_PARAMSET>(m, "BINFHE_PARAMSET")
+          .value("TOY", BINFHE_PARAMSET::TOY)
+          .value("MEDIUM", BINFHE_PARAMSET::MEDIUM)
+          .value("STD128_LMKCDEY", BINFHE_PARAMSET::STD128_LMKCDEY)
+          .value("STD128_AP", BINFHE_PARAMSET::STD128_AP)
+          .value("STD128", BINFHE_PARAMSET::STD128)
+          .value("STD192", BINFHE_PARAMSET::STD192)
+          .value("STD256", BINFHE_PARAMSET::STD256)
+          .value("STD128Q", BINFHE_PARAMSET::STD128Q)
+          .value("STD128Q_LMKCDEY", BINFHE_PARAMSET::STD128Q_LMKCDEY)
+          .value("STD192Q", BINFHE_PARAMSET::STD192Q)
+          .value("STD256Q", BINFHE_PARAMSET::STD256Q)
+          .value("STD128_3", BINFHE_PARAMSET::STD128_3)
+          .value("STD128_3_LMKCDEY", BINFHE_PARAMSET::STD128_3_LMKCDEY)
+          .value("STD128Q_3", BINFHE_PARAMSET::STD128Q_3)
+          .value("STD128Q_3_LMKCDEY", BINFHE_PARAMSET::STD128Q_3_LMKCDEY)
+          .value("STD192Q_3", BINFHE_PARAMSET::STD192Q_3)
+          .value("STD256Q_3", BINFHE_PARAMSET::STD256Q_3)
+          .value("STD128_4", BINFHE_PARAMSET::STD128_4)
+          .value("STD128_4_LMKCDEY", BINFHE_PARAMSET::STD128_4_LMKCDEY)
+          .value("STD128Q_4", BINFHE_PARAMSET::STD128Q_4)
+          .value("STD128Q_4_LMKCDEY", BINFHE_PARAMSET::STD128Q_4_LMKCDEY)
+          .value("STD192Q_4", BINFHE_PARAMSET::STD192Q_4)
+          .value("STD256Q_4", BINFHE_PARAMSET::STD256Q_4)
+          .value("SIGNED_MOD_TEST", BINFHE_PARAMSET::SIGNED_MOD_TEST);
+     m.attr("TOY") = py::cast(BINFHE_PARAMSET::TOY);
+     m.attr("MEDIUM") = py::cast(BINFHE_PARAMSET::MEDIUM);
+     m.attr("STD128_LMKCDEY") = py::cast(BINFHE_PARAMSET::STD128_LMKCDEY);
+     m.attr("STD128_AP") = py::cast(BINFHE_PARAMSET::STD128_AP);
+     m.attr("STD128") = py::cast(BINFHE_PARAMSET::STD128);
+     m.attr("STD192") = py::cast(BINFHE_PARAMSET::STD192);
+     m.attr("STD256") = py::cast(BINFHE_PARAMSET::STD256);
+     m.attr("STD128Q") = py::cast(BINFHE_PARAMSET::STD128Q);
+     m.attr("STD128Q_LMKCDEY") = py::cast(BINFHE_PARAMSET::STD128Q_LMKCDEY);
+     m.attr("STD192Q") = py::cast(BINFHE_PARAMSET::STD192Q);
+     m.attr("STD256Q") = py::cast(BINFHE_PARAMSET::STD256Q);
+     m.attr("STD128_3") = py::cast(BINFHE_PARAMSET::STD128_3);
+     m.attr("STD128_3_LMKCDEY") = py::cast(BINFHE_PARAMSET::STD128_3_LMKCDEY);
+     m.attr("STD128Q_3") = py::cast(BINFHE_PARAMSET::STD128Q_3);
+     m.attr("STD128Q_3_LMKCDEY") = py::cast(BINFHE_PARAMSET::STD128Q_3_LMKCDEY);
+     m.attr("STD192Q_3") = py::cast(BINFHE_PARAMSET::STD192Q_3);
+     m.attr("STD256Q_3") = py::cast(BINFHE_PARAMSET::STD256Q_3);
+     m.attr("STD128_4") = py::cast(BINFHE_PARAMSET::STD128_4);
+     m.attr("STD128_4_LMKCDEY") = py::cast(BINFHE_PARAMSET::STD128_4_LMKCDEY);
+     m.attr("STD128Q_4") = py::cast(BINFHE_PARAMSET::STD128Q_4);
+     m.attr("STD128Q_4_LMKCDEY") = py::cast(BINFHE_PARAMSET::STD128Q_4_LMKCDEY);
+     m.attr("STD192Q_4") = py::cast(BINFHE_PARAMSET::STD192Q_4);
+     m.attr("STD256Q_4") = py::cast(BINFHE_PARAMSET::STD256Q_4);
+     m.attr("SIGNED_MOD_TEST") = py::cast(BINFHE_PARAMSET::SIGNED_MOD_TEST);
 
-  py::enum_<BINFHE_METHOD>(m, "BINFHE_METHOD")
-      .value("INVALID_METHOD", BINFHE_METHOD::INVALID_METHOD)
-      .value("AP", BINFHE_METHOD::AP)
-      .value("GINX", BINFHE_METHOD::GINX)
-      .value("LMKCDEY", BINFHE_METHOD::LMKCDEY);
-  m.attr("INVALID_METHOD") = py::cast(BINFHE_METHOD::INVALID_METHOD);
-  m.attr("GINX") = py::cast(BINFHE_METHOD::GINX);
-  m.attr("AP") = py::cast(BINFHE_METHOD::AP);
-  m.attr("LMKCDEY") = py::cast(BINFHE_METHOD::LMKCDEY);
+     py::enum_<BINFHE_METHOD>(m, "BINFHE_METHOD")
+          .value("INVALID_METHOD", BINFHE_METHOD::INVALID_METHOD)
+          .value("AP", BINFHE_METHOD::AP)
+          .value("GINX", BINFHE_METHOD::GINX)
+          .value("LMKCDEY", BINFHE_METHOD::LMKCDEY);
+     m.attr("INVALID_METHOD") = py::cast(BINFHE_METHOD::INVALID_METHOD);
+     m.attr("GINX") = py::cast(BINFHE_METHOD::GINX);
+     m.attr("AP") = py::cast(BINFHE_METHOD::AP);
+     m.attr("LMKCDEY") = py::cast(BINFHE_METHOD::LMKCDEY);
 
-  py::enum_<KEYGEN_MODE>(m, "KEYGEN_MODE")
-      .value("SYM_ENCRYPT", KEYGEN_MODE::SYM_ENCRYPT)
-      .value("PUB_ENCRYPT", KEYGEN_MODE::PUB_ENCRYPT);
-  m.attr("SYM_ENCRYPT") = py::cast(KEYGEN_MODE::SYM_ENCRYPT);
-  m.attr("PUB_ENCRYPT") = py::cast(KEYGEN_MODE::PUB_ENCRYPT);
+     py::enum_<KEYGEN_MODE>(m, "KEYGEN_MODE")
+          .value("SYM_ENCRYPT", KEYGEN_MODE::SYM_ENCRYPT)
+          .value("PUB_ENCRYPT", KEYGEN_MODE::PUB_ENCRYPT);
+     m.attr("SYM_ENCRYPT") = py::cast(KEYGEN_MODE::SYM_ENCRYPT);
+     m.attr("PUB_ENCRYPT") = py::cast(KEYGEN_MODE::PUB_ENCRYPT);
 
-  py::enum_<BINFHE_OUTPUT>(m, "BINFHE_OUTPUT")
-      .value("INVALID_OUTPUT", BINFHE_OUTPUT::INVALID_OUTPUT)
-      .value("FRESH", BINFHE_OUTPUT::FRESH)
-      .value("BOOTSTRAPPED", BINFHE_OUTPUT::BOOTSTRAPPED);
-  m.attr("INVALID_OUTPUT") = py::cast(BINFHE_OUTPUT::INVALID_OUTPUT);
-  m.attr("FRESH") = py::cast(BINFHE_OUTPUT::FRESH);
-  m.attr("BOOTSTRAPPED") = py::cast(BINFHE_OUTPUT::BOOTSTRAPPED);
+     py::enum_<BINFHE_OUTPUT>(m, "BINFHE_OUTPUT")
+          .value("INVALID_OUTPUT", BINFHE_OUTPUT::INVALID_OUTPUT)
+          .value("FRESH", BINFHE_OUTPUT::FRESH)
+          .value("BOOTSTRAPPED", BINFHE_OUTPUT::BOOTSTRAPPED);
+     m.attr("INVALID_OUTPUT") = py::cast(BINFHE_OUTPUT::INVALID_OUTPUT);
+     m.attr("FRESH") = py::cast(BINFHE_OUTPUT::FRESH);
+     m.attr("BOOTSTRAPPED") = py::cast(BINFHE_OUTPUT::BOOTSTRAPPED);
 
-  py::enum_<BINGATE>(m, "BINGATE")
-      .value("OR", BINGATE::OR)
-      .value("AND", BINGATE::AND)
-      .value("NOR", BINGATE::NOR)
-      .value("NAND", BINGATE::NAND)
-      .value("XOR_FAST", BINGATE::XOR_FAST)
-      .value("XNOR_FAST", BINGATE::XNOR_FAST)
-      .value("XOR", BINGATE::XOR)
-      .value("XNOR", BINGATE::XNOR);
-  m.attr("OR") = py::cast(BINGATE::OR);
-  m.attr("AND") = py::cast(BINGATE::AND);
-  m.attr("NOR") = py::cast(BINGATE::NOR);
-  m.attr("NAND") = py::cast(BINGATE::NAND);
-  m.attr("XOR_FAST") = py::cast(BINGATE::XOR_FAST);
-  m.attr("XNOR_FAST") = py::cast(BINGATE::XNOR_FAST);
-  m.attr("XOR") = py::cast(BINGATE::XOR);
-  m.attr("XNOR") = py::cast(BINGATE::XNOR);
+     py::enum_<BINGATE>(m, "BINGATE")
+          .value("OR", BINGATE::OR)
+          .value("AND", BINGATE::AND)
+          .value("NOR", BINGATE::NOR)
+          .value("NAND", BINGATE::NAND)
+          .value("XOR_FAST", BINGATE::XOR_FAST)
+          .value("XNOR_FAST", BINGATE::XNOR_FAST)
+          .value("XOR", BINGATE::XOR)
+          .value("XNOR", BINGATE::XNOR);
+     m.attr("OR") = py::cast(BINGATE::OR);
+     m.attr("AND") = py::cast(BINGATE::AND);
+     m.attr("NOR") = py::cast(BINGATE::NOR);
+     m.attr("NAND") = py::cast(BINGATE::NAND);
+     m.attr("XOR_FAST") = py::cast(BINGATE::XOR_FAST);
+     m.attr("XNOR_FAST") = py::cast(BINGATE::XNOR_FAST);
+     m.attr("XOR") = py::cast(BINGATE::XOR);
+     m.attr("XNOR") = py::cast(BINGATE::XNOR);
 }
 
 void bind_binfhe_keys(py::module &m) {
-  py::class_<LWEPrivateKeyImpl, std::shared_ptr<LWEPrivateKeyImpl>>(
-      m, "LWEPrivateKey")
-      .def(py::init<>())
-      .def("GetLength", &LWEPrivateKeyImpl::GetLength)
-      .def(py::self == py::self)
-      .def(py::self != py::self);
+     py::class_<LWEPrivateKeyImpl, std::shared_ptr<LWEPrivateKeyImpl>>(m, "LWEPrivateKey")
+          .def(py::init<>())
+          .def("GetLength", &LWEPrivateKeyImpl::GetLength)
+          .def(py::self == py::self)
+          .def(py::self != py::self);
 }
 void bind_binfhe_ciphertext(py::module &m) {
-  py::class_<LWECiphertextImpl, std::shared_ptr<LWECiphertextImpl>>(
-      m, "LWECiphertext")
-      .def(py::init<>())
-      .def("GetLength", &LWECiphertextImpl::GetLength)
-      .def("GetModulus", &GetLWECiphertextModulusWrapper)
-      .def(py::self == py::self)
-      .def(py::self != py::self);
+     py::class_<LWECiphertextImpl, std::shared_ptr<LWECiphertextImpl>>(m, "LWECiphertext")
+          .def(py::init<>())
+          .def("GetLength", &LWECiphertextImpl::GetLength)
+          .def("GetModulus",
+               [](LWECiphertext& self) {
+                    return self->GetModulus().ConvertToInt<uint64_t>();
+               })
+          .def(py::self == py::self)
+          .def(py::self != py::self);
 }
 
 void bind_binfhe_context(py::module &m) {
-  py::class_<BinFHEContext, std::shared_ptr<BinFHEContext>>(m, "BinFHEContext")
-      .def(py::init<>())
-      .def("GenerateBinFHEContext",
-           static_cast<void (BinFHEContext::*)(BINFHE_PARAMSET, BINFHE_METHOD)>(
-               &BinFHEContext::GenerateBinFHEContext),
-           binfhe_GenerateBinFHEContext_parset_docs, py::arg("set"),
-           py::arg("method") = GINX)
-      // void GenerateBinFHEContext(BINFHE_PARAMSET set, bool arbFunc, uint32_t
-      // logQ = 11, int64_t N = 0, BINFHE_METHOD method = GINX, bool
-      // timeOptimization = false)
-      .def("GenerateBinFHEContext",
-           static_cast<void (BinFHEContext::*)(BINFHE_PARAMSET, bool, uint32_t,
-                                               uint32_t, BINFHE_METHOD, bool)>(
-               &BinFHEContext::GenerateBinFHEContext),
-           binfhe_GenerateBinFHEContext_docs, py::arg("set"),
-           py::arg("arbFunc"), py::arg("logQ") = 11, py::arg("N") = 0,
-           py::arg("method") = GINX, py::arg("timeOptimization") = false)
-      .def("KeyGen", &BinFHEContext::KeyGen, binfhe_KeyGen_docs)
-      .def("KeyGenN", &BinFHEContext::KeyGenN)
-      .def("KeyGenPair", &BinFHEContext::KeyGenPair)
-      .def("BTKeyGen", &BinFHEContext::BTKeyGen, binfhe_BTKeyGen_docs,
-           py::arg("sk"), py::arg("keygenMode") = SYM_ENCRYPT)
-      .def("Encrypt", &binfhe_EncryptWrapper, binfhe_Encrypt_docs,
-           py::arg("sk"), py::arg("m"), py::arg("output") = BOOTSTRAPPED,
-           py::arg("p") = 4, py::arg("mod") = 0)
-      .def("Decrypt", &binfhe_DecryptWrapper, binfhe_Decrypt_docs,
-           py::arg("sk"), py::arg("ct"), py::arg("p") = 4)
-      .def("EvalBinGate",
-           static_cast<LWECiphertext (BinFHEContext::*)(
-               BINGATE, ConstLWECiphertext &, ConstLWECiphertext &, bool) const>(
-               &BinFHEContext::EvalBinGate),
-           binfhe_EvalBinGate_docs, py::arg("gate"), py::arg("ct1"),
-           py::arg("ct2"), py::arg("extended") = false)
-      .def("EvalBinGate",
-           static_cast<LWECiphertext (BinFHEContext::*)(
-               BINGATE, const std::vector<LWECiphertext> &, bool) const>(
-               &BinFHEContext::EvalBinGate),
-           py::arg("gate"), py::arg("ctvector"), py::arg("extended") = false)
-      .def("EvalNOT", &BinFHEContext::EvalNOT, binfhe_EvalNOT_docs,
-           py::arg("ct"))
-      .def("Getn", &GetnWrapper)
-      .def("Getq", &GetqWrapper)
-      .def("GetMaxPlaintextSpace", &GetMaxPlaintextSpaceWrapper)
-      .def("GetBeta", &GetBetaWrapper)
-      .def("EvalDecomp", &BinFHEContext::EvalDecomp, binfhe_EvalDecomp_docs,
-           py::arg("ct"))
-      .def("EvalFloor", &BinFHEContext::EvalFloor, binfhe_EvalFloor_docs,
-           py::arg("ct"), py::arg("roundbits") = 0)
-      .def("GenerateLUTviaFunction", &GenerateLUTviaFunctionWrapper,
-           binfhe_GenerateLUTviaFunction_docs, py::arg("f"), py::arg("p"))
-      .def("EvalFunc", &EvalFuncWrapper, binfhe_EvalFunc_docs, py::arg("ct"),
-           py::arg("LUT"))
-      .def("EvalSign", &BinFHEContext::EvalSign, binfhe_EvalSign_docs,
-           py::arg("ct"), py::arg("schemeSwitch") = false)
-      .def("EvalNOT", &BinFHEContext::EvalNOT)
-      .def("EvalConstant", &BinFHEContext::EvalConstant)
-      .def("ClearBTKeys", &BinFHEContext::ClearBTKeys)
-      .def("Bootstrap", &BinFHEContext::Bootstrap, py::arg("ct"), py::arg("extended") = false)
-      .def("SerializedVersion", &BinFHEContext::SerializedVersion,
-           binfhe_SerializedVersion_docs)
-      .def("SerializedObjectName", &BinFHEContext::SerializedObjectName,
-           binfhe_SerializedObjectName_docs)
-      .def("SaveJSON", &BinFHEContext::save<cereal::JSONOutputArchive>)
-      .def("LoadJSON", &BinFHEContext::load<cereal::JSONInputArchive>)
-      .def("SaveBinary", &BinFHEContext::save<cereal::BinaryOutputArchive>)
-      .def("LoadBinary", &BinFHEContext::load<cereal::BinaryInputArchive>)
-      .def("SavePortableBinary",
-           &BinFHEContext::save<cereal::PortableBinaryOutputArchive>)
-      .def("LoadPortableBinary",
-           &BinFHEContext::load<cereal::PortableBinaryInputArchive>)
-      .def("GetPublicKey", &BinFHEContext::GetPublicKey)
-      .def("GetSwitchKey", &BinFHEContext::GetSwitchKey)
-      .def("GetRefreshKey", &BinFHEContext::GetRefreshKey)
-      .def("GetBinFHEScheme", &BinFHEContext::GetBinFHEScheme)
-      .def("GetLWEScheme", &BinFHEContext::GetLWEScheme)
-      .def("GetParams", &BinFHEContext::GetParams);
+     py::class_<BinFHEContext, std::shared_ptr<BinFHEContext>>(m, "BinFHEContext")
+          .def(py::init<>())
+          .def("GenerateBinFHEContext",
+               py::overload_cast<BINFHE_PARAMSET, BINFHE_METHOD>(&BinFHEContext::GenerateBinFHEContext),
+               binfhe_GenerateBinFHEContext_parset_docs,
+               py::arg("set"),
+               py::arg("method") = GINX)
+          // void GenerateBinFHEContext(BINFHE_PARAMSET set, bool arbFunc, uint32_t
+          // logQ = 11, int64_t N = 0, BINFHE_METHOD method = GINX, bool
+          // timeOptimization = false)
+          .def("GenerateBinFHEContext",
+               py::overload_cast<BINFHE_PARAMSET, bool, uint32_t, uint32_t, BINFHE_METHOD, bool>(&BinFHEContext::GenerateBinFHEContext),
+               binfhe_GenerateBinFHEContext_docs,
+               py::arg("set"),
+               py::arg("arbFunc"),
+               py::arg("logQ") = 11,
+               py::arg("N") = 0,
+               py::arg("method") = GINX,
+               py::arg("timeOptimization") = false)
+          .def("KeyGen", &BinFHEContext::KeyGen, binfhe_KeyGen_docs)
+          .def("KeyGenN", &BinFHEContext::KeyGenN)
+          .def("KeyGenPair", &BinFHEContext::KeyGenPair)
+          .def("BTKeyGen", &BinFHEContext::BTKeyGen,
+               binfhe_BTKeyGen_docs,
+               py::arg("sk"),
+               py::arg("keygenMode") = SYM_ENCRYPT)
+          .def("Encrypt",
+               [](BinFHEContext& self, ConstLWEPrivateKey sk, const LWEPlaintext& m, BINFHE_OUTPUT output, LWEPlaintextModulus p, uint64_t mod) {
+                    return self.Encrypt(sk, m, output, p, NativeInteger(mod));
+               },
+               py::arg("sk"),
+               py::arg("m"),
+               py::arg("output") = BOOTSTRAPPED,
+               py::arg("p") = 4,
+               py::arg("mod") = 0,
+               py::doc(binfhe_Encrypt_docs))
+          .def("Decrypt",
+               [](BinFHEContext& self, ConstLWEPrivateKey sk, ConstLWECiphertext ct, LWEPlaintextModulus p) {
+                    LWEPlaintext result;
+                    self.Decrypt(sk, ct, &result, p);
+                    return result;
+               },
+               py::arg("sk"),
+               py::arg("ct"),
+               py::arg("p") = 4,
+               py::doc(binfhe_Decrypt_docs))
+          .def("EvalBinGate",
+               py::overload_cast<BINGATE, ConstLWECiphertext&, ConstLWECiphertext&, bool>(&BinFHEContext::EvalBinGate, py::const_),
+               binfhe_EvalBinGate_docs,
+               py::arg("gate"),
+               py::arg("ct1"),
+               py::arg("ct2"),
+               py::arg("extended") = false)
+          .def("EvalBinGate",
+               py::overload_cast<BINGATE, const std::vector<LWECiphertext>&, bool>(&BinFHEContext::EvalBinGate, py::const_),
+               py::arg("gate"),
+               py::arg("ctvector"),
+               py::arg("extended") = false)
+          .def("EvalNOT", &BinFHEContext::EvalNOT,
+               binfhe_EvalNOT_docs,
+               py::arg("ct"))
+          .def("Getn",
+               [](BinFHEContext& self) {
+                    return self.GetParams()->GetLWEParams()->Getn();
+               })
+          .def("Getq",
+               [](BinFHEContext& self) {
+                    return self.GetParams()->GetLWEParams()->Getq().ConvertToInt<uint64_t>();
+               })
+          .def("GetMaxPlaintextSpace",
+               [](BinFHEContext& self) {
+                    return self.GetMaxPlaintextSpace().ConvertToInt<uint64_t>();
+               })
+          .def("GetBeta",
+               [](BinFHEContext& self) {
+                    return self.GetBeta().ConvertToInt<uint64_t>();
+               })
+          .def("EvalDecomp", &BinFHEContext::EvalDecomp,
+               binfhe_EvalDecomp_docs,
+               py::arg("ct"))
+          .def("EvalFloor", &BinFHEContext::EvalFloor,
+               binfhe_EvalFloor_docs,
+               py::arg("ct"),
+               py::arg("roundbits") = 0)
+          .def("GenerateLUTviaFunction", &GenerateLUTviaFunctionWrapper,
+               binfhe_GenerateLUTviaFunction_docs,
+               py::arg("f"),
+               py::arg("p"))
+          .def("EvalFunc",
+               [](BinFHEContext& self, ConstLWECiphertext& ct, const std::vector<uint64_t>& LUT) {
+                    std::vector<NativeInteger> nativeLUT;
+                    nativeLUT.reserve(LUT.size());
+                    for (auto value : LUT) {
+                         nativeLUT.emplace_back(value);
+                    }
+                    return self.EvalFunc(ct, nativeLUT);
+               },
+               py::arg("ct"),
+               py::arg("LUT"),
+               py::doc(binfhe_EvalFunc_docs))
+          .def("EvalSign", &BinFHEContext::EvalSign,
+               binfhe_EvalSign_docs,
+               py::arg("ct"),
+               py::arg("schemeSwitch") = false)
+          .def("EvalConstant", &BinFHEContext::EvalConstant)
+          .def("ClearBTKeys", &BinFHEContext::ClearBTKeys)
+          .def("Bootstrap", &BinFHEContext::Bootstrap, py::arg("ct"), py::arg("extended") = false)
+          .def("SerializedVersion", &BinFHEContext::SerializedVersion,
+               binfhe_SerializedVersion_docs)
+          .def("SerializedObjectName", &BinFHEContext::SerializedObjectName,
+               binfhe_SerializedObjectName_docs)
+          .def("SaveJSON", &BinFHEContext::save<cereal::JSONOutputArchive>)
+          .def("LoadJSON", &BinFHEContext::load<cereal::JSONInputArchive>)
+          .def("SaveBinary", &BinFHEContext::save<cereal::BinaryOutputArchive>)
+          .def("LoadBinary", &BinFHEContext::load<cereal::BinaryInputArchive>)
+          .def("SavePortableBinary", &BinFHEContext::save<cereal::PortableBinaryOutputArchive>)
+          .def("LoadPortableBinary", &BinFHEContext::load<cereal::PortableBinaryInputArchive>)
+          .def("GetPublicKey", &BinFHEContext::GetPublicKey)
+          .def("GetSwitchKey", &BinFHEContext::GetSwitchKey)
+          .def("GetRefreshKey", &BinFHEContext::GetRefreshKey)
+          .def("GetBinFHEScheme", &BinFHEContext::GetBinFHEScheme)
+          .def("GetLWEScheme", &BinFHEContext::GetLWEScheme)
+          .def("GetParams", &BinFHEContext::GetParams);
 }

+ 0 - 148
src/lib/pke/cryptocontext_wrapper.cpp

@@ -1,148 +0,0 @@
-//==================================================================================
-// BSD 2-Clause License
-//
-// Copyright (c) 2023-2025, Duality Technologies Inc. and other contributors
-//
-// All rights reserved.
-//
-// Author TPOC: contact@openfhe.org
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//==================================================================================
-#include "cryptocontext_wrapper.h"
-
-
-Ciphertext<DCRTPoly> EvalFastRotationPrecomputeWrapper(CryptoContext<DCRTPoly> &self,ConstCiphertext<DCRTPoly> ciphertext) {
-    std::shared_ptr<std::vector<DCRTPoly>> precomp = self->EvalFastRotationPrecompute(ciphertext);
-    std::vector<DCRTPoly> elements = *(precomp.get());
-    std::shared_ptr<CiphertextImpl<DCRTPoly>> cipherdigits = std::make_shared<CiphertextImpl<DCRTPoly>>(self);
-    cipherdigits->SetElements(std::move(elements));
-    return cipherdigits;
-}
-Ciphertext<DCRTPoly> EvalFastRotationWrapper(CryptoContext<DCRTPoly>& self,ConstCiphertext<DCRTPoly> ciphertext, uint32_t index, uint32_t m,ConstCiphertext<DCRTPoly> digits) {
-    
-        std::vector<DCRTPoly> digitsElements = digits->GetElements();
-        std::shared_ptr<std::vector<DCRTPoly>> digitsElementsPtr = std::make_shared<std::vector<DCRTPoly>>(digitsElements);
-        return self->EvalFastRotation(ciphertext, index, m, digitsElementsPtr);
-    }
-
-Ciphertext<DCRTPoly> EvalFastRotationExtWrapper(CryptoContext<DCRTPoly>& self,ConstCiphertext<DCRTPoly> ciphertext, uint32_t index, ConstCiphertext<DCRTPoly> digits, bool addFirst) {
-    std::vector<DCRTPoly> digitsElements = digits->GetElements();
-    std::shared_ptr<std::vector<DCRTPoly>> digitsElementsPtr = std::make_shared<std::vector<DCRTPoly>>(digitsElements);
-    return self->EvalFastRotationExt(ciphertext, index, digitsElementsPtr, addFirst);
-}
-
-
-Plaintext DecryptWrapper(CryptoContext<DCRTPoly>& self,ConstCiphertext<DCRTPoly> ciphertext,const PrivateKey<DCRTPoly> privateKey){
-    Plaintext plaintextDecResult;
-    self->Decrypt(privateKey, ciphertext,&plaintextDecResult);
-    return plaintextDecResult;
-}
-Plaintext DecryptWrapper(CryptoContext<DCRTPoly>& self,const PrivateKey<DCRTPoly> privateKey,ConstCiphertext<DCRTPoly> ciphertext){
-    Plaintext plaintextDecResult;
-    self->Decrypt(privateKey, ciphertext,&plaintextDecResult);
-    return plaintextDecResult;
-}
-
-Plaintext MultipartyDecryptFusionWrapper(CryptoContext<DCRTPoly>& self,const std::vector<Ciphertext<DCRTPoly>>& partialCiphertextVec){
-    Plaintext plaintextDecResult;
-    self->MultipartyDecryptFusion(partialCiphertextVec,&plaintextDecResult);
-    return plaintextDecResult;
-}
-
-const std::shared_ptr<std::map<uint32_t, EvalKey<DCRTPoly>>> GetEvalSumKeyMapWrapper(CryptoContext<DCRTPoly>& self,const std::string &keyTag){
-    return std::make_shared<std::map<uint32_t, EvalKey<DCRTPoly>>>(CryptoContextImpl<DCRTPoly>::GetEvalSumKeyMap(keyTag));;
-}
-
-PlaintextModulus GetPlaintextModulusWrapper(CryptoContext<DCRTPoly>& self){
-    return self->GetCryptoParameters()->GetPlaintextModulus();
-}
-
-uint32_t GetBatchSizeWrapper(CryptoContext<DCRTPoly>& self){
-    return self->GetCryptoParameters()->GetBatchSize();
-}
-
-double GetModulusWrapper(CryptoContext<DCRTPoly>& self){
-    return self->GetCryptoParameters()->GetElementParams()->GetModulus().ConvertToDouble();
-}
-
-void RemoveElementWrapper(Ciphertext<DCRTPoly> &self, uint32_t index){
-    self->GetElements().erase(self->GetElements().begin()+index);
-}
-uint32_t GetDigitSizeWrapper(CryptoContext<DCRTPoly>& self){
-    return self->GetCryptoParameters()->GetDigitSize();
-}
-
-double GetScalingFactorRealWrapper(CryptoContext<DCRTPoly>& self, uint32_t l){
-    if(self->getSchemeId()==SCHEME::CKKSRNS_SCHEME){
-        const auto cryptoParams = std::dynamic_pointer_cast<CryptoParametersCKKSRNS>(self->GetCryptoParameters());
-        double scFactor = cryptoParams->GetScalingFactorReal(l);
-        return scFactor;
-    }
-    else if(self->getSchemeId()==SCHEME::BFVRNS_SCHEME){
-        const auto cryptoParams = std::dynamic_pointer_cast<CryptoParametersBFVRNS>(self->GetCryptoParameters());
-        double scFactor = cryptoParams->GetScalingFactorReal(l);
-        return scFactor;
-    }
-    else if(self->getSchemeId()==SCHEME::BGVRNS_SCHEME){
-        const auto cryptoParams = std::dynamic_pointer_cast<CryptoParametersBGVRNS>(self->GetCryptoParameters());
-        double scFactor = cryptoParams->GetScalingFactorReal(l);
-        return scFactor;
-    }
-    else{
-        OPENFHE_THROW("Invalid scheme");
-        return 0;
-    }
-}
-
-uint64_t GetModulusCKKSWrapper(CryptoContext<DCRTPoly> &self)
-{
-
-    const auto cryptoParams = std::dynamic_pointer_cast<CryptoParametersCKKSRNS>(self->GetCryptoParameters());
-    ILDCRTParams<DCRTPoly::Integer> elementParams = *(cryptoParams->GetElementParams());
-    auto paramsQ = elementParams.GetParams();
-    uint64_t modulus_CKKS_from = paramsQ[0]->GetModulus().ConvertToInt<uint64_t>();
-    return modulus_CKKS_from;
-}
-
-ScalingTechnique GetScalingTechniqueWrapper(CryptoContext<DCRTPoly> & self){
-    if(self->getSchemeId()==SCHEME::CKKSRNS_SCHEME){
-        const auto cryptoParams = std::dynamic_pointer_cast<CryptoParametersCKKSRNS>(self->GetCryptoParameters());
-        return cryptoParams->GetScalingTechnique();
-    }
-    else if(self->getSchemeId()==SCHEME::BFVRNS_SCHEME){
-        const auto cryptoParams = std::dynamic_pointer_cast<CryptoParametersBFVRNS>(self->GetCryptoParameters());
-        return cryptoParams->GetScalingTechnique();
-    }
-    else if(self->getSchemeId()==SCHEME::BGVRNS_SCHEME){
-        const auto cryptoParams = std::dynamic_pointer_cast<CryptoParametersBGVRNS>(self->GetCryptoParameters());
-        return cryptoParams->GetScalingTechnique();
-    }
-    else{
-        OPENFHE_THROW("Invalid scheme");
-    }
-
-}
-
-void ClearEvalMultKeysWrapper() {
-    CryptoContextImpl<DCRTPoly>::ClearEvalMultKeys();
-}

Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor