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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ build/
.png
.json
.txt
.cproject
.project
.settings/
demoData/
14 changes: 7 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ find_package(OpenFHE)
find_package(pybind11 REQUIRED)

set( CMAKE_CXX_FLAGS ${OpenFHE_CXX_FLAGS} )
set( OpenFHE_Py_SOURCES src)
set( OpenFHE_Py_INCLUDES include)
set( OpenFHE_Py_SOURCES src/lib)
set( OpenFHE_Py_INCLUDES src/include)

include_directories( ${OPENMP_INCLUDES} )
include_directories( ${OpenFHE_INCLUDE} )
Expand Down Expand Up @@ -42,11 +42,11 @@ endif()

### Pybind Modules
pybind11_add_module(openfhe
src/bindings.cpp
src/binfhe_bindings.cpp
src/binfhe/binfhecontext_wrapper.cpp
src/pke/serialization.cpp
src/pke/cryptocontext_wrapper.cpp
src/lib/bindings.cpp
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)
Expand Down
49 changes: 23 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ mkdir build
cd build
cmake .. # Alternatively, cmake .. -DOpenFHE_DIR=/path/to/installed/openfhe
make
make install # You may have to run sudo make install
```

At this point the `.so` file has been built. Your exact installation process will depend on your virtual environment.
Expand All @@ -59,8 +60,9 @@ To do this, run the following commands:
```bash
mkdir build
cd build
cmake .. # Or cmake .. -DPYTHON_EXECUTABLE_PATH=$CONDA_PREFIX/bin/python
cmake .. -DPYTHON_EXECUTABLE_PATH=$CONDA_PREFIX/bin/python
make
make install # You may have to run sudo make install
```

The CONDA_PREFIX variable is set by conda, and points to the root of your active conda environment.
Expand All @@ -77,41 +79,36 @@ which creates a lib folder, moves the built `.so` file into that lib folder, and

**Note** You may wish to copy the `.so` file to any projects of your own, or add it to your system path to source from.

#### System install

```
make install # You may have to run sudo make install
```

## Code Examples

To get familiar with the OpenFHE Python API, check out the examples:

- FHE for arithmetic over integers (BFV):
- [Simple Code Example](src/pke/examples/simple-integers.py)
<!-- - [Simple Code Example with Serialization](src/pke/examples/simple-integers-serial.py) -->
- [Simple Code Example](examples/pke/simple-integers.py)
<!-- - [Simple Code Example with Serialization](examples/pke/simple-integers-serial.py) -->
- FHE for arithmetic over integers (BGV):
- [Simple Code Example](src/pke/examples/simple-integers-bgvrns.py)
<!-- - [Simple Code Example with Serialization](src/pke/examples/simple-integers-serial-bgvrns.py) -->
- [Simple Code Example](examples/pke/simple-integers-bgvrns.py)
<!-- - [Simple Code Example with Serialization](examples/pke/simple-integers-serial-bgvrns.py) -->
- FHE for arithmetic over real numbers (CKKS):
- [Simple Code Example](src/pke/examples/simple-real-numbers.py)
- [Advanced Code Example](src/pke/examples/advanced-real-numbers.py)
- [Advanced Code Example for High-Precision CKKS](src/pke/examples/advanced-real-numbers-128.py)
- [Arbitrary Smooth Function Evaluation](src/pke/examples/function-evaluation.py)
- [Simple CKKS Bootstrapping Example](src/pke/examples/simple-ckks-bootstrapping.py)
- [Advanced CKKS Bootstrapping Example](src/pke/examples/advanced-ckks-bootstrapping.cpp)
- [Double-Precision (Iterative) Bootstrapping Example](src/pke/examples/iterative-ckks-bootstrapping.py)
- [Simple Code Example](examples/pke/simple-real-numbers.py)
- [Advanced Code Example](examples/pke/advanced-real-numbers.py)
- [Advanced Code Example for High-Precision CKKS](examples/pke/advanced-real-numbers-128.py)
- [Arbitrary Smooth Function Evaluation](examples/pke/function-evaluation.py)
- [Simple CKKS Bootstrapping Example](examples/pke/simple-ckks-bootstrapping.py)
- [Advanced CKKS Bootstrapping Example](examples/pke/advanced-ckks-bootstrapping.cpp)
- [Double-Precision (Iterative) Bootstrapping Example](examples/pke/iterative-ckks-bootstrapping.py)
- FHE for Boolean circuits and larger plaintext spaces (FHEW/TFHE):
- [Simple Code Example](src/binfhe/examples/boolean.py)
- [Truth Table Example](src/binfhe/examples/boolean-truth-table.py)
<!-- - [Code with JSON serialization](src/binfhe/examples/boolean-serial-json.py) -->
<!-- - [Code with Binary Serialization](src/binfhe/examples/boolean-serial-binary.py) -->
<!-- - [Large-Precision Comparison](src/binfhe/examples/eval-sign.py) -->
<!-- - [Small-Precison Arbitrary Function Evaluation](src/binfhe/examples/eval-function.py) -->
- [Simple Code Example](examples/binfhe/boolean.py)
- [Truth Table Example](examples/binfhe/boolean-truth-table.py)
<!-- - [Code with JSON serialization](examples/binfhe/boolean-serial-json.py) -->
<!-- - [Code with Binary Serialization](examples/binfhe/boolean-serial-binary.py) -->
<!-- - [Large-Precision Comparison](examples/binfhe/eval-sign.py) -->
<!-- - [Small-Precison Arbitrary Function Evaluation](examples/binfhe/eval-function.py) -->
<!-- - Threshold FHE: -->
<!-- - [Code Example for BGV, BFV, and CKKS](src/pke/examples/threshold-fhe.py) -->
<!-- - [Code Example for BFV with 5 parties](src/pke/examples/threshold-fhe-5p.py) -->
<!-- - [Code Example for BGV, BFV, and CKKS](examples/pke/threshold-fhe.py) -->
<!-- - [Code Example for BFV with 5 parties](examples/pke/threshold-fhe-5p.py) -->

## OpenFHE Python Wrapper Documentation

[OpenFHE Python Wrapper API Reference](https://openfheorg.github.io/openfhe-python/html/index.html)

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions src/binfhe_bindings.cpp → src/lib/binfhe_bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,14 @@ void bind_binfhe_enums(py::module &m)
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);
Expand Down
File renamed without changes.