A fork of https://github.com/fairmath/openfhe-rs to add some missing functionality
Hovsep Papoyan 21daf6fd46 Adding functions related to EncodingParams | 5 月之前 | |
---|---|---|
examples | 5 月之前 | |
src | 5 月之前 | |
.gitignore | 5 月之前 | |
Cargo.toml | 5 月之前 | |
LICENSE | 7 月之前 | |
README.md | 5 月之前 | |
build.rs | 5 月之前 |
☀️ OpenFHE-rs is a joint project by FairMath & OpenFHE
🔔 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.
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.
You can use this library as a cargo crate from crates.io or build it from the source.
In both cases you need to have the core OpenFHE library installed on your system to support the low-level optimizations.
On Debian systems, everything can be installed with the following command:
sudo apt install build-essential libssl-dev cmake clang git
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):
git clone https://github.com/fairmath/openfhe.git
cd openfhe
cmake -B ${OPENFHE_BUILD:-build} -DBUILD_EXAMPLES=ON -DBUILD_EXTRAS=ON -DBUILD_SHARED=ON .
make -C ${OPENFHE_BUILD:-build} -j$(nproc)
make -C ${OPENFHE_BUILD:-build} install
sudo ldconfig
To get the cargo crate from crates.io, you need to add it as a dependency to you project:
cargo add openfhe
You also need to add a small piece of code for core dependencies configuration in your build.rs file:
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");
}
Instead of doing it manually, you start your project by forking our template repository.
You can adjust the installation process by building the crate mannually. In that case you need to clone the Fair Math openfhe-rs repo to your local machine and build it:
Clone the repository
git clone https://github.com/fairmath/openfhe-rs.git
cd openfhe-rs
bash
cargo build
Run tests
cargo test -- --test-threads=1
bash
cargo run --example polynomial_evaluation