Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
cmake_minimum_required (VERSION 3.5.1)
cmake_minimum_required (VERSION 3.16.3)

project (OpenFHE-Python)

set(OPENFHE_PYTHON_VERSION_MAJOR 1)
set(OPENFHE_PYTHON_VERSION_MINOR 3)
set(OPENFHE_PYTHON_VERSION_PATCH 1)
set(OPENFHE_PYTHON_VERSION_MINOR 4)
set(OPENFHE_PYTHON_VERSION_PATCH 0)
set(OPENFHE_PYTHON_VERSION_TWEAK 0)
set(OPENFHE_PYTHON_VERSION ${OPENFHE_PYTHON_VERSION_MAJOR}.${OPENFHE_PYTHON_VERSION_MINOR}.${OPENFHE_PYTHON_VERSION_PATCH}.${OPENFHE_PYTHON_VERSION_TWEAK})

# OpenFHE version can be specified externally (-DOPENFHE_REQUIRED_VERSION=1.3.1)
# OpenFHE version can be specified externally (-DOPENFHE_REQUIRED_VERSION=1.4.0)
if(NOT DEFINED OPENFHE_REQUIRED_VERSION)
set(OPENFHE_REQUIRED_VERSION "1.3.1" CACHE STRING "Required OpenFHE version")
set(OPENFHE_REQUIRED_VERSION "1.4.0" CACHE STRING "Required OpenFHE version")
else()
# User provided OPENFHE_REQUIRED_VERSION via -D
message(STATUS "Using user-specified OpenFHE version: ${OPENFHE_REQUIRED_VERSION}")
Expand Down Expand Up @@ -71,8 +71,11 @@ 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
)
# The next line ensures that the installed openfhe module can find its shared library dependencies
# in the 'lib/' subdirectory relative to itself without requiring LD_LIBRARY_PATH.
target_link_options(openfhe PRIVATE "-Wl,-rpath=$ORIGIN/lib" "-Wl,--disable-new-dtags")

### Python installation
# Allow the user to specify the path to Python executable (if not provided, find it)
option(PYTHON_EXECUTABLE_PATH "Path to Python executable" "")
Expand Down Expand Up @@ -104,5 +107,5 @@ else()
endif()
message("***** INSTALL IS AT ${Python_Install_Location}; to change, run cmake with -DCMAKE_INSTALL_PREFIX=/your/path")
install(TARGETS openfhe LIBRARY DESTINATION ${Python_Install_Location})
install(FILES ${CMAKE_SOURCE_DIR}/__init__.py DESTINATION ${Python_Install_Location})
install(FILES ${CMAKE_SOURCE_DIR}/src/__init__.py DESTINATION ${Python_Install_Location})

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Please see [Instructions for the Docker setup](docker/README.md)

Before building, make sure you have the following dependencies installed:

- [OpenFHE 1.3.1+](https://github.com/openfheorg/openfhe-development) by following the instructions in [OpenFHE Documentation](https://openfhe-development.readthedocs.io/en/latest/sphinx_rsts/intro/installation/installation.html)
- [OpenFHE 1.4.0+](https://github.com/openfheorg/openfhe-development) by following the instructions in [OpenFHE Documentation](https://openfhe-development.readthedocs.io/en/latest/sphinx_rsts/intro/installation/installation.html)
- [Python 3.6+](https://www.python.org/)
- [pybind11](https://pybind11.readthedocs.io/en/stable/installing.html)

Expand Down
48 changes: 0 additions & 48 deletions __init__.py

This file was deleted.

2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# The short X.Y version
version = ''
# The full version, including alpha/beta/rc tags
release = '0.8.0'
release = 'v1.3.1.0'


# -- General configuration ---------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions src/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .openfhe import *
33 changes: 2 additions & 31 deletions src/include/binfhe/binfhecontext_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__
13 changes: 8 additions & 5 deletions src/include/docstrings/cryptocontext_docs.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,13 @@ const char* cc_MakeCoefPackedPlaintext_docs = R"pbdoc(

:param value: vector of signed integers mod t
:type value: List[int]
:param noiseScaleDeg : is degree of the scaling factor to encode the plaintext at
:type noiseScaleDeg : int
:param noiseScaleDeg: is degree of the scaling factor to encode the plaintext at
:type noiseScaleDeg: int
:param level: is the level to encode the plaintext at
:type level: int
:return: plaintext
:rtype: Plaintext

)pbdoc";

const char* cc_MakeCKKSPackedPlaintextComplex_docs = R"pbdoc(
Expand Down Expand Up @@ -1179,9 +1180,10 @@ const char* cc_InsertEvalAutomorphismKey_docs = R"pbdoc(
Add the given map of keys to the map, replacing the existing map if there is one

:param evalKeyMap: map of keys to be inserted
:type EvalKeyMap
:type evalKeyMap: EvalKeyMap
:param keyTag: key identifier for the given key map
:type keyTag: str

)pbdoc";

const char* cc_EvalSum_docs = R"pbdoc(
Expand Down Expand Up @@ -1376,10 +1378,11 @@ const char* cc_EvalFHEWtoCKKSSetup_docs = R"pbdoc(

:param ccLWE: Source FHEW crypto context.
:type ccLWE: BinFHEContext
:param numSlotsCKKS Number of slots in resulting CKKS ciphertext.
:param numSlotsCKKS: Number of slots in resulting CKKS ciphertext.
:type numSlotsCKKS: int
:param logQ: Ciphertext modulus size in FHEW (for high precision).
:param logQ: Ciphertext modulus size in FHEW (for high precision).
:type logQ: int

)pbdoc";

const char* cc_EvalFHEWtoCKKSKeyGen_docs = R"pbdoc(
Expand Down
67 changes: 0 additions & 67 deletions src/include/pke/cryptocontext_wrapper.h

This file was deleted.

Loading