|
@@ -42,37 +42,44 @@ void bind_binfhe_enums(py::module &m)
|
|
py::enum_<BINFHE_PARAMSET>(m, "BINFHE_PARAMSET")
|
|
py::enum_<BINFHE_PARAMSET>(m, "BINFHE_PARAMSET")
|
|
.value("TOY", BINFHE_PARAMSET::TOY)
|
|
.value("TOY", BINFHE_PARAMSET::TOY)
|
|
.value("MEDIUM", BINFHE_PARAMSET::MEDIUM)
|
|
.value("MEDIUM", BINFHE_PARAMSET::MEDIUM)
|
|
|
|
+ .value("STD128_LMKCDEY", BINFHE_PARAMSET::STD128_LMKCDEY)
|
|
.value("STD128_AP", BINFHE_PARAMSET::STD128_AP)
|
|
.value("STD128_AP", BINFHE_PARAMSET::STD128_AP)
|
|
- .value("STD128_APOPT", BINFHE_PARAMSET::STD128_APOPT)
|
|
|
|
.value("STD128", BINFHE_PARAMSET::STD128)
|
|
.value("STD128", BINFHE_PARAMSET::STD128)
|
|
- .value("STD128_OPT", BINFHE_PARAMSET::STD128_OPT)
|
|
|
|
.value("STD192", BINFHE_PARAMSET::STD192)
|
|
.value("STD192", BINFHE_PARAMSET::STD192)
|
|
- .value("STD192_OPT", BINFHE_PARAMSET::STD192_OPT)
|
|
|
|
.value("STD256", BINFHE_PARAMSET::STD256)
|
|
.value("STD256", BINFHE_PARAMSET::STD256)
|
|
- .value("STD256_OPT", BINFHE_PARAMSET::STD256_OPT)
|
|
|
|
.value("STD128Q", BINFHE_PARAMSET::STD128Q)
|
|
.value("STD128Q", BINFHE_PARAMSET::STD128Q)
|
|
- .value("STD128Q_OPT", BINFHE_PARAMSET::STD128Q_OPT)
|
|
|
|
|
|
+ .value("STD128Q_LMKCDEY", BINFHE_PARAMSET::STD128Q_LMKCDEY)
|
|
.value("STD192Q", BINFHE_PARAMSET::STD192Q)
|
|
.value("STD192Q", BINFHE_PARAMSET::STD192Q)
|
|
- .value("STD192Q_OPT", BINFHE_PARAMSET::STD192Q_OPT)
|
|
|
|
.value("STD256Q", BINFHE_PARAMSET::STD256Q)
|
|
.value("STD256Q", BINFHE_PARAMSET::STD256Q)
|
|
- .value("STD256Q_OPT", BINFHE_PARAMSET::STD256Q_OPT)
|
|
|
|
|
|
+ .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);
|
|
.value("SIGNED_MOD_TEST", BINFHE_PARAMSET::SIGNED_MOD_TEST);
|
|
m.attr("TOY") = py::cast(BINFHE_PARAMSET::TOY);
|
|
m.attr("TOY") = py::cast(BINFHE_PARAMSET::TOY);
|
|
m.attr("MEDIUM") = py::cast(BINFHE_PARAMSET::MEDIUM);
|
|
m.attr("MEDIUM") = py::cast(BINFHE_PARAMSET::MEDIUM);
|
|
- m.attr("STD128_AP") = py::cast(BINFHE_PARAMSET::STD128_AP);
|
|
|
|
- m.attr("STD128_APOPT") = py::cast(BINFHE_PARAMSET::STD128_APOPT);
|
|
|
|
- m.attr("STD128") = py::cast(BINFHE_PARAMSET::STD128);
|
|
|
|
- m.attr("STD128_OPT") = py::cast(BINFHE_PARAMSET::STD128_OPT);
|
|
|
|
- m.attr("STD192") = py::cast(BINFHE_PARAMSET::STD192);
|
|
|
|
- m.attr("STD192_OPT") = py::cast(BINFHE_PARAMSET::STD192_OPT);
|
|
|
|
- m.attr("STD256") = py::cast(BINFHE_PARAMSET::STD256);
|
|
|
|
- m.attr("STD256_OPT") = py::cast(BINFHE_PARAMSET::STD256_OPT);
|
|
|
|
- m.attr("STD128Q") = py::cast(BINFHE_PARAMSET::STD128Q);
|
|
|
|
- m.attr("STD128Q_OPT") = py::cast(BINFHE_PARAMSET::STD128Q_OPT);
|
|
|
|
- m.attr("STD192Q") = py::cast(BINFHE_PARAMSET::STD192Q);
|
|
|
|
- m.attr("STD192Q_OPT") = py::cast(BINFHE_PARAMSET::STD192Q_OPT);
|
|
|
|
- m.attr("STD256Q") = py::cast(BINFHE_PARAMSET::STD256Q);
|
|
|
|
- m.attr("STD256Q_OPT") = py::cast(BINFHE_PARAMSET::STD256Q_OPT);
|
|
|
|
|
|
+ m.attr("STD128_LMKCDEY") = py::cast(BINFHE_PARAMSET::STD128_LMKCDEY);
|
|
|
|
+ m.attr("STD128Q_LMKCDEY") = py::cast(BINFHE_PARAMSET::STD128Q_LMKCDEY);
|
|
|
|
+ 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);
|
|
m.attr("SIGNED_MOD_TEST") = py::cast(BINFHE_PARAMSET::SIGNED_MOD_TEST);
|
|
|
|
|
|
py::enum_<BINFHE_METHOD>(m, "BINFHE_METHOD")
|
|
py::enum_<BINFHE_METHOD>(m, "BINFHE_METHOD")
|
|
@@ -134,31 +141,33 @@ void bind_binfhe_context(py::module &m)
|
|
.def(py::init<>())
|
|
.def(py::init<>())
|
|
.def("GenerateBinFHEContext", static_cast<void (BinFHEContext::*)(BINFHE_PARAMSET, BINFHE_METHOD)>(&BinFHEContext::GenerateBinFHEContext),
|
|
.def("GenerateBinFHEContext", static_cast<void (BinFHEContext::*)(BINFHE_PARAMSET, BINFHE_METHOD)>(&BinFHEContext::GenerateBinFHEContext),
|
|
binfhe_GenerateBinFHEContext_parset_docs,
|
|
binfhe_GenerateBinFHEContext_parset_docs,
|
|
- py::arg("set"),
|
|
|
|
|
|
+ py::arg("set"),
|
|
py::arg("method") = GINX)
|
|
py::arg("method") = GINX)
|
|
.def("KeyGen", &BinFHEContext::KeyGen,
|
|
.def("KeyGen", &BinFHEContext::KeyGen,
|
|
- binfhe_KeyGen_docs)
|
|
|
|
|
|
+ binfhe_KeyGen_docs)
|
|
.def("BTKeyGen", &BinFHEContext::BTKeyGen,
|
|
.def("BTKeyGen", &BinFHEContext::BTKeyGen,
|
|
- binfhe_BTKeyGen_docs)
|
|
|
|
|
|
+ binfhe_BTKeyGen_docs)
|
|
.def("Encrypt", &binfhe_EncryptWrapper,
|
|
.def("Encrypt", &binfhe_EncryptWrapper,
|
|
binfhe_Encrypt_docs,
|
|
binfhe_Encrypt_docs,
|
|
py::arg("sk"),
|
|
py::arg("sk"),
|
|
py::arg("m"),
|
|
py::arg("m"),
|
|
py::arg("output") = BOOTSTRAPPED,
|
|
py::arg("output") = BOOTSTRAPPED,
|
|
- py::arg("p") = 4,
|
|
|
|
|
|
+ py::arg("p") = 4,
|
|
py::arg("mod") = 0)
|
|
py::arg("mod") = 0)
|
|
- .def("Decrypt",&binfhe_DecryptWrapper,
|
|
|
|
|
|
+ .def("Decrypt", &binfhe_DecryptWrapper,
|
|
binfhe_Decrypt_docs,
|
|
binfhe_Decrypt_docs,
|
|
py::arg("sk"),
|
|
py::arg("sk"),
|
|
py::arg("ct"),
|
|
py::arg("ct"),
|
|
py::arg("p") = 4)
|
|
py::arg("p") = 4)
|
|
- .def("EvalBinGate",&BinFHEContext::EvalBinGate,
|
|
|
|
|
|
+ // LWECiphertext EvalBinGate(BINGATE gate, ConstLWECiphertext& ct1, ConstLWECiphertext& ct2) const
|
|
|
|
+ // bind using static_cast
|
|
|
|
+ .def("EvalBinGate",
|
|
|
|
+ static_cast<LWECiphertext (BinFHEContext::*)(BINGATE, ConstLWECiphertext &, ConstLWECiphertext &) const>(&BinFHEContext::EvalBinGate),
|
|
binfhe_EvalBinGate_docs,
|
|
binfhe_EvalBinGate_docs,
|
|
py::arg("gate"),
|
|
py::arg("gate"),
|
|
py::arg("ct1"),
|
|
py::arg("ct1"),
|
|
py::arg("ct2"))
|
|
py::arg("ct2"))
|
|
- .def("EvalNOT",&BinFHEContext::EvalNOT,
|
|
|
|
|
|
+ .def("EvalNOT", &BinFHEContext::EvalNOT,
|
|
binfhe_EvalNOT_docs,
|
|
binfhe_EvalNOT_docs,
|
|
py::arg("ct"));
|
|
py::arg("ct"));
|
|
-
|
|
|
|
}
|
|
}
|