|
@@ -5,19 +5,23 @@
|
|
|
[](https://discord.com/invite/NfhXwyr9M5)
|
|
|
[](https://twitter.com/FairMath)
|
|
|
|
|
|
+🔔 *Keep in mind that the library is WIP and may contain some unpolished interfaces. If you struggle with anything or have suggestions, feel free to ping us on our Discord server or open a new issue in the [Github repository](https://github.com/fairmath/openfhe-rs/tree/master).*
|
|
|
+
|
|
|
+---
|
|
|
+
|
|
|
OpenFHE-rs is a Rust interface for the OpenFHE library. OpenFHE is known for its wide range of Fully Homomorphic Encryption (FHE) schemes,
|
|
|
all implemented in C++. We're bringing this capability to Rust developers.
|
|
|
|
|
|
By offering a Rust wrapper for OpenFHE, we make it easier for Rust devs to use advanced FHE schemes in their projects.
|
|
|
Whether you're building secure data processing apps or privacy-focused tools, OpenFHE-rs helps you do that with the power of OpenFHE's encryption technology.
|
|
|
|
|
|
-# Current status
|
|
|
+# Installation
|
|
|
|
|
|
-The library is under development and the ETA of the first version is set to Q2 2024.
|
|
|
+You can use this library as a cargo crate from [crates.io](https://crates.io/crates/openfhe) or build it from the source.
|
|
|
|
|
|
-# Installation from source
|
|
|
+In both cases you need to have the core OpenFHE library installed on your system to support the low-level optimizations.
|
|
|
|
|
|
-## Install Dependencies
|
|
|
+## Install dependencies
|
|
|
|
|
|
* CMake >= 3.5.1
|
|
|
* Clang >= 12.0 or GCC >= 11.4
|
|
@@ -34,53 +38,86 @@ sudo apt install build-essential libssl-dev cmake clang git
|
|
|
|
|
|
## Installation process
|
|
|
|
|
|
-1. Build and install OpenFHE library. Right now you need to use the Fair Math fork. It contains the required features, which will be included in the next planned release (v1.1.5):
|
|
|
+### Core OpenFHE library installation
|
|
|
+
|
|
|
+Build and install OpenFHE library. Right now you need to use the Fair Math fork. It contains the required features, which will be included in the next planned release (v1.1.5):
|
|
|
+
|
|
|
+1. Clone the repository
|
|
|
+
|
|
|
+```bash
|
|
|
+git clone https://github.com/fairmath/openfhe.git
|
|
|
+cd openfhe
|
|
|
+```
|
|
|
+
|
|
|
+2. Configure CMake
|
|
|
+
|
|
|
+```bash
|
|
|
+cmake -B ${OPENFHE_BUILD:-build} -DBUILD_EXAMPLES=ON -DBUILD_EXTRAS=ON -DBUILD_SHARED=ON .
|
|
|
+```
|
|
|
+
|
|
|
+3. Build and install the C++ OpenFHE library
|
|
|
+
|
|
|
+```bash
|
|
|
+make -C ${OPENFHE_BUILD:-build} -j$(nproc)
|
|
|
+make -C ${OPENFHE_BUILD:-build} install
|
|
|
+```
|
|
|
+
|
|
|
+4. Configure your dynamic linker
|
|
|
|
|
|
- 1. Clone the repository
|
|
|
+```bash
|
|
|
+sudo ldconfig
|
|
|
+```
|
|
|
|
|
|
- ```bash
|
|
|
- git clone https://github.com/fairmath/openfhe.git
|
|
|
- cd openfhe
|
|
|
- ```
|
|
|
+## Configuring your project to use the crate
|
|
|
|
|
|
- 2. Configure CMake
|
|
|
+To get the cargo crate from [crates.io](https://crates.io/crates/openfhe), you need to add it as a dependency to you project:
|
|
|
|
|
|
- ```bash
|
|
|
- cmake -B ${OPENFHE_BUILD:-build} -DBUILD_EXAMPLES=ON -DBUILD_EXTRAS=ON -DBUILD_SHARED=ON .
|
|
|
- ```
|
|
|
+```bash
|
|
|
+cargo add openfhe
|
|
|
+```
|
|
|
|
|
|
- 3. Build and install the C++ OpenFHE library
|
|
|
+You also need to add a small piece of code for core dependencies configuration in your build.rs file:
|
|
|
+
|
|
|
+```rs
|
|
|
+fn main
|
|
|
+{
|
|
|
+ // linking openFHE
|
|
|
+ println!("cargo::rustc-link-arg=-L/usr/local/lib");
|
|
|
+ println!("cargo::rustc-link-arg=-lOPENFHEpke");
|
|
|
+ println!("cargo::rustc-link-arg=-lOPENFHEbinfhe");
|
|
|
+ println!("cargo::rustc-link-arg=-lOPENFHEcore");
|
|
|
+ // linking OpenMP
|
|
|
+ println!("cargo::rustc-link-arg=-fopenmp");
|
|
|
+ // necessary to avoid LD_LIBRARY_PATH
|
|
|
+ println!("cargo::rustc-link-arg=-Wl,-rpath=/usr/local/lib");
|
|
|
+}
|
|
|
+```
|
|
|
|
|
|
- ```bash
|
|
|
- make -C ${OPENFHE_BUILD:-build} -j$(nproc)
|
|
|
- make -C ${OPENFHE_BUILD:-build} install
|
|
|
- ```
|
|
|
+### Template repository
|
|
|
|
|
|
- 4. Configure your dynamic linker
|
|
|
+Instead of doing it manually, you start your project by forking our [template repository](https://github.com/fairmath/openfhe-rs-template/tree/main).
|
|
|
|
|
|
- ```bash
|
|
|
- sudo ldconfig
|
|
|
- ```
|
|
|
-2. Make sure you have [rustc](https://www.rust-lang.org/tools/install) with `cargo` installed first.
|
|
|
+# Custom crate installation from source
|
|
|
|
|
|
-3. Clone the Fair Math [openfhe-rs](https://github.com/fairmath/openfhe-rs) repo to your local machine and build:
|
|
|
- 1. Clone the repository
|
|
|
- ```bash
|
|
|
- git clone https://github.com/fairmath/openfhe-rs.git
|
|
|
- cd openfhe-rs
|
|
|
- ```
|
|
|
+You can adjust the installation process by building the crate mannually. In that case you need to clone the Fair Math [openfhe-rs](https://github.com/fairmath/openfhe-rs) repo to your local machine and build it:
|
|
|
|
|
|
- 2. Build the library
|
|
|
- ```bash
|
|
|
- cargo build
|
|
|
- ```
|
|
|
+1. Clone the repository
|
|
|
+```bash
|
|
|
+git clone https://github.com/fairmath/openfhe-rs.git
|
|
|
+cd openfhe-rs
|
|
|
+```
|
|
|
|
|
|
- 3. Run tests
|
|
|
- ```bash
|
|
|
- cargo test -- --test-threads=1
|
|
|
- ```
|
|
|
+2. Build the library
|
|
|
+```bash
|
|
|
+cargo build
|
|
|
+```
|
|
|
|
|
|
- 4. Run the examples
|
|
|
- ```bash
|
|
|
- cargo run --example polynomial_evaluation
|
|
|
- ```
|
|
|
+3. Run tests
|
|
|
+```bash
|
|
|
+cargo test -- --test-threads=1
|
|
|
+```
|
|
|
+
|
|
|
+4. Run the examples
|
|
|
+```bash
|
|
|
+cargo run --example polynomial_evaluation
|
|
|
+```
|