From 0ea3e6bd8552c922445398d2220d984ce0875520 Mon Sep 17 00:00:00 2001 From: Dmitriy Suponitskiy Date: Fri, 11 Apr 2025 14:28:37 -0400 Subject: [PATCH 1/2] Bind EvalAddMany and minor disclaimer correction --- src/include/bindings.h | 2 +- src/include/binfhe/binfhecontext_wrapper.h | 19 +++++++++++-------- src/include/binfhe_bindings.h | 19 +++++++++++-------- src/include/docstrings/binfhecontext_docs.h | 19 +++++++++++-------- src/include/docstrings/ciphertext_docs.h | 19 +++++++++++-------- src/include/docstrings/cryptocontext_docs.h | 19 +++++++++++-------- .../docstrings/cryptoparameters_docs.h | 19 +++++++++++-------- src/include/docstrings/plaintext_docs.h | 19 +++++++++++-------- src/include/pke/cryptocontext_wrapper.h | 2 +- src/include/pke/serialization.h | 2 +- src/lib/bindings.cpp | 4 +++- src/lib/binfhe/binfhecontext_wrapper.cpp | 19 +++++++++++-------- src/lib/binfhe_bindings.cpp | 2 +- src/lib/pke/cryptocontext_wrapper.cpp | 2 +- src/lib/pke/serialization.cpp | 2 +- 15 files changed, 97 insertions(+), 71 deletions(-) diff --git a/src/include/bindings.h b/src/include/bindings.h index b3e19a0..1f06ba6 100644 --- a/src/include/bindings.h +++ b/src/include/bindings.h @@ -1,7 +1,7 @@ //================================================================================== // BSD 2-Clause License // -// Copyright (c) 2014-2025, NJIT, Duality Technologies Inc. and other contributors +// Copyright (c) 2023-2025, Duality Technologies Inc. and other contributors // // All rights reserved. // diff --git a/src/include/binfhe/binfhecontext_wrapper.h b/src/include/binfhe/binfhecontext_wrapper.h index 43be926..a9603de 100644 --- a/src/include/binfhe/binfhecontext_wrapper.h +++ b/src/include/binfhe/binfhecontext_wrapper.h @@ -1,19 +1,22 @@ +//================================================================================== // BSD 2-Clause License - -// Copyright (c) 2023, OpenFHE - +// +// 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 @@ -24,7 +27,7 @@ // 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 __BINFHECONTEXT_WRAPPER_H__ #define __BINFHECONTEXT_WRAPPER_H__ diff --git a/src/include/binfhe_bindings.h b/src/include/binfhe_bindings.h index 22c6b50..e2f49ef 100644 --- a/src/include/binfhe_bindings.h +++ b/src/include/binfhe_bindings.h @@ -1,19 +1,22 @@ +//================================================================================== // BSD 2-Clause License - -// Copyright (c) 2023, OpenFHE - +// +// 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 @@ -24,7 +27,7 @@ // 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 __BINFHE_BINDINGS_H__ #define __BINFHE_BINDINGS_H__ diff --git a/src/include/docstrings/binfhecontext_docs.h b/src/include/docstrings/binfhecontext_docs.h index 65f20ca..94f299c 100644 --- a/src/include/docstrings/binfhecontext_docs.h +++ b/src/include/docstrings/binfhecontext_docs.h @@ -1,19 +1,22 @@ +//================================================================================== // BSD 2-Clause License - -// Copyright (c) 2023, OpenFHE - +// +// 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 @@ -24,7 +27,7 @@ // 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 __BINFHECONTEXT_DOCS_H #define __BINFHECONTEXT_DOCS_H diff --git a/src/include/docstrings/ciphertext_docs.h b/src/include/docstrings/ciphertext_docs.h index 65fc165..08ce61a 100644 --- a/src/include/docstrings/ciphertext_docs.h +++ b/src/include/docstrings/ciphertext_docs.h @@ -1,19 +1,22 @@ +//================================================================================== // BSD 2-Clause License - -// Copyright (c) 2023, OpenFHE - +// +// 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 @@ -24,7 +27,7 @@ // 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 __CIPHERTEXT_DOCS_H__ #define __CIPHERTEXT_DOCS_H__ diff --git a/src/include/docstrings/cryptocontext_docs.h b/src/include/docstrings/cryptocontext_docs.h index d343d12..c8861c5 100644 --- a/src/include/docstrings/cryptocontext_docs.h +++ b/src/include/docstrings/cryptocontext_docs.h @@ -1,19 +1,22 @@ +//================================================================================== // BSD 2-Clause License - -// Copyright (c) 2023, OpenFHE - +// +// 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 @@ -24,7 +27,7 @@ // 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_DOCS_H__ #define __CRYPTOCONTEXT_DOCS_H__ diff --git a/src/include/docstrings/cryptoparameters_docs.h b/src/include/docstrings/cryptoparameters_docs.h index 62469c0..8ae9ddd 100644 --- a/src/include/docstrings/cryptoparameters_docs.h +++ b/src/include/docstrings/cryptoparameters_docs.h @@ -1,19 +1,22 @@ +//================================================================================== // BSD 2-Clause License - -// Copyright (c) 2023, OpenFHE - +// +// 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 @@ -24,7 +27,7 @@ // 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 __CRYPTOPARAMETERS_DOCS_H__ #define __CRYPTOPARAMETERS_DOCS_H__ diff --git a/src/include/docstrings/plaintext_docs.h b/src/include/docstrings/plaintext_docs.h index 9027b12..f83b456 100644 --- a/src/include/docstrings/plaintext_docs.h +++ b/src/include/docstrings/plaintext_docs.h @@ -1,19 +1,22 @@ +//================================================================================== // BSD 2-Clause License - -// Copyright (c) 2023, OpenFHE - +// +// 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 @@ -24,7 +27,7 @@ // 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 __PLAINTEXT_DOCS_H__ #define __PLAINTEXT_DOCS_H__ diff --git a/src/include/pke/cryptocontext_wrapper.h b/src/include/pke/cryptocontext_wrapper.h index 7318d20..a625bb1 100644 --- a/src/include/pke/cryptocontext_wrapper.h +++ b/src/include/pke/cryptocontext_wrapper.h @@ -1,7 +1,7 @@ //================================================================================== // BSD 2-Clause License // -// Copyright (c) 2014-2025, NJIT, Duality Technologies Inc. and other contributors +// Copyright (c) 2023-2025, Duality Technologies Inc. and other contributors // // All rights reserved. // diff --git a/src/include/pke/serialization.h b/src/include/pke/serialization.h index 9515881..7a19c6f 100644 --- a/src/include/pke/serialization.h +++ b/src/include/pke/serialization.h @@ -1,7 +1,7 @@ //================================================================================== // BSD 2-Clause License // -// Copyright (c) 2014-2025, NJIT, Duality Technologies Inc. and other contributors +// Copyright (c) 2023-2025, Duality Technologies Inc. and other contributors // // All rights reserved. // diff --git a/src/lib/bindings.cpp b/src/lib/bindings.cpp index 1be1cc5..242b234 100644 --- a/src/lib/bindings.cpp +++ b/src/lib/bindings.cpp @@ -1,7 +1,7 @@ //================================================================================== // BSD 2-Clause License // -// Copyright (c) 2014-2025, NJIT, Duality Technologies Inc. and other contributors +// Copyright (c) 2023-2025, Duality Technologies Inc. and other contributors // // All rights reserved. // @@ -772,6 +772,8 @@ void bind_crypto_context(py::module &m) py::arg("towersLeft")) .def("EvalMultMany", &CryptoContextImpl::EvalMultMany, py::arg("ciphertextVec")) + .def("EvalAddMany", &CryptoContextImpl::EvalAddManyInPlace, + py::arg("ciphertextVec")) .def("EvalAddManyInPlace", &CryptoContextImpl::EvalAddManyInPlace, py::arg("ciphertextVec")) .def("FindAutomorphismIndex", &CryptoContextImpl::FindAutomorphismIndex, diff --git a/src/lib/binfhe/binfhecontext_wrapper.cpp b/src/lib/binfhe/binfhecontext_wrapper.cpp index 102ff9e..37338f1 100644 --- a/src/lib/binfhe/binfhecontext_wrapper.cpp +++ b/src/lib/binfhe/binfhecontext_wrapper.cpp @@ -1,19 +1,22 @@ +//================================================================================== // BSD 2-Clause License - -// Copyright (c) 2023, OpenFHE - +// +// 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 @@ -24,7 +27,7 @@ // 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 #include #include diff --git a/src/lib/binfhe_bindings.cpp b/src/lib/binfhe_bindings.cpp index e957799..d85c56f 100644 --- a/src/lib/binfhe_bindings.cpp +++ b/src/lib/binfhe_bindings.cpp @@ -1,7 +1,7 @@ //================================================================================== // BSD 2-Clause License // -// Copyright (c) 2014-2025, NJIT, Duality Technologies Inc. and other contributors +// Copyright (c) 2023-2025, Duality Technologies Inc. and other contributors // // All rights reserved. // diff --git a/src/lib/pke/cryptocontext_wrapper.cpp b/src/lib/pke/cryptocontext_wrapper.cpp index f8ed8f2..d8328a4 100644 --- a/src/lib/pke/cryptocontext_wrapper.cpp +++ b/src/lib/pke/cryptocontext_wrapper.cpp @@ -1,7 +1,7 @@ //================================================================================== // BSD 2-Clause License // -// Copyright (c) 2014-2025, NJIT, Duality Technologies Inc. and other contributors +// Copyright (c) 2023-2025, Duality Technologies Inc. and other contributors // // All rights reserved. // diff --git a/src/lib/pke/serialization.cpp b/src/lib/pke/serialization.cpp index 5ed9e21..f23613e 100644 --- a/src/lib/pke/serialization.cpp +++ b/src/lib/pke/serialization.cpp @@ -1,7 +1,7 @@ //================================================================================== // BSD 2-Clause License // -// Copyright (c) 2014-2025, NJIT, Duality Technologies Inc. and other contributors +// Copyright (c) 2023-2025, Duality Technologies Inc. and other contributors // // All rights reserved. // From ef029ce996d5fd157a6eb5efd3fa34f295c82155 Mon Sep 17 00:00:00 2001 From: Dmitriy Suponitskiy Date: Thu, 17 Apr 2025 14:08:54 -0400 Subject: [PATCH 2/2] Correction to EvalAddMany's binding --- src/lib/bindings.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/bindings.cpp b/src/lib/bindings.cpp index 242b234..aef46b8 100644 --- a/src/lib/bindings.cpp +++ b/src/lib/bindings.cpp @@ -772,7 +772,7 @@ void bind_crypto_context(py::module &m) py::arg("towersLeft")) .def("EvalMultMany", &CryptoContextImpl::EvalMultMany, py::arg("ciphertextVec")) - .def("EvalAddMany", &CryptoContextImpl::EvalAddManyInPlace, + .def("EvalAddMany", &CryptoContextImpl::EvalAddMany, py::arg("ciphertextVec")) .def("EvalAddManyInPlace", &CryptoContextImpl::EvalAddManyInPlace, py::arg("ciphertextVec"))