Browse Source

initial bindings for BFV CCParams

Rener Oliveira (Ubuntu WSL) 2 years ago
parent
commit
90933cd348
2 changed files with 41 additions and 0 deletions
  1. 33 0
      src/bindings.cpp
  2. 8 0
      src/bindings.h

+ 33 - 0
src/bindings.cpp

@@ -0,0 +1,33 @@
+#include <pybind11/pybind11.h>
+#include <scheme/bfvrns/cryptocontextparams-bfvrns.h>
+#include <scheme/cryptocontextparams-base.h>
+#include <core/utils/inttypes.h>
+#include "bindings.h"
+
+using namespace lbcrypto;
+namespace py = pybind11;
+
+
+void bind_parameters(py::module &m){
+    py::class_<Params>(m, "Params");
+    py::class_<CCParams<CryptoContextBFVRNS>, Params>(m, "CCParamsBFVRNS")
+            .def(py::init<>())
+            // setters
+            .def("SetPlaintextModulus", &CCParams<CryptoContextBFVRNS>::SetPlaintextModulus)
+            .def("SetMultiplicativeDepth",&CCParams<CryptoContextBFVRNS>::SetMultiplicativeDepth)
+            // getters
+            .def("GetPlaintextModulus", &CCParams<CryptoContextBFVRNS>::GetPlaintextModulus)
+            .def("GetMultiplicativeDepth", &CCParams<CryptoContextBFVRNS>::GetMultiplicativeDepth);
+            //  .def_property("multiplicativeDepth",
+            // &CCParams<CryptoContextBFVRNS>::GetMultiplicativeDepth,
+            // &CCParams<CryptoContextBFVRNS>::SetMultiplicativeDepth)
+            // .def_property("ptModulus",
+            // &CCParams<CryptoContextBFVRNS>::GetPlaintextModulus,
+            // &CCParams<CryptoContextBFVRNS>::SetPlaintextModulus);
+}
+
+PYBIND11_MODULE(openfhe, m) {
+    m.doc() = "Open-Source Fully Homomorphic Encryption Library";
+    bind_parameters(m);
+
+}

+ 8 - 0
src/bindings.h

@@ -0,0 +1,8 @@
+#ifndef OPENFHE_BINDINGS_H
+#define OPENFHE_BINDINGS_H
+
+#include <pybind11/pybind11.h>
+
+void bind_parameters(pybind11::module &m);
+
+#endif // OPENFHE_BINDINGS_H