#compiler #fhe #lib #homomorphic-encryption #encryption #mlir #llvm #privacy #security


Concrete is a fully homomorphic encryption (FHE) library that implements Zama's variant of TFHE

6 releases

0.1.5 Dec 4, 2020
0.1.4 Dec 4, 2020
0.1.3 Nov 20, 2020
0.1.0 Oct 1, 2020

#2241 in Cryptography

Download history 12/week @ 2023-10-28 3/week @ 2023-11-04 5/week @ 2023-11-11 6/week @ 2023-11-18 12/week @ 2023-11-25 32/week @ 2023-12-02 5/week @ 2023-12-09 10/week @ 2023-12-16 15/week @ 2023-12-23 8/week @ 2023-12-30 4/week @ 2024-01-06 5/week @ 2024-01-13 9/week @ 2024-01-20 22/week @ 2024-01-27 12/week @ 2024-02-03 26/week @ 2024-02-10

70 downloads per month


28K SLoC


Development has moved to the concrete crate. Watch out that your Cargo.toml file has the right following dependency:

concrete = "^0.1"

We thank Daniel May for supporting this project and donating the Concrete crate.

Concrete Operates oN Ciphertexts Rapidly by Extending TfhE

Concrete is a fully homomorphic encryption (FHE) library that implements Zama's variant of TFHE. Concrete is based on the Learning With Errors (LWE) problem and on the Ring Learning With Errors (RLWE) problem, which are well studied cryptographic hardness assumptions believed to be secure even against quantum computers.

To use Concrete, you must install Rust, FFTW and add concrete to the list of dependencies.

Rust installation

To install rust on Linux or Macos, you can do the following:

curl  --tlsv1.2 -sSf https://sh.rustup.rs | sh

If you want other rust installation methods, please refer to rust website.

FFTW and openssl installation

You also need to install FFTW and openssl library.


The more straightforward way to install fftw is to use Homebrew Formulae. To install homebrew, you can do the following:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

And then install FFTW and openssl.

brew install fftw
brew install openssl


To install FFTW on a debian-based distribution, you can do the following:

sudo apt-get update && sudo apt-get install -y libfftw3-dev libssl-dev

From source

If you want to install FFTW directly from source, you can follow the steps described in FFTW's website.

Use concrete in your own project

You need to add the Concrete library as a dependency in your Rust project.

To do so, simply add the dependency in the Cargo.toml file. Here is a simple example:

name = "play_with_fhe"
version = "0.1.0"
authors = ["FHE Curious"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

concrete_lib = "0.1"

Now, you can compile your project with the cargo build command, which will fetch the Concrete library.

It is also possible to build the library from source by cloning this repository and running:

cd concrete
make build


To run the tests, you can do the following

cd concrete
make test


use concrete_lib::*;
use crypto_api::error::CryptoAPIError;

fn main() -> Result<(), CryptoAPIError> {
    // generate a secret key
    let secret_key = LWESecretKey::new(&LWE128_630);

    // the two values to add
    let m1 = 8.2;
    let m2 = 5.6;

    // specify the range and precision to encode messages into plaintexts
    // here we encode in [0, 10[ with 8 bits of precision and 1 bit of padding
    let encoder = Encoder::new(0., 10., 8, 1)?;

    // encode the messages into plaintexts
    let p1 = encoder.encode_single(m1)?;
    let p2 = encoder.encode_single(m2)?;

    // encrypt plaintexts
    let mut c1 = VectorLWE::encrypt(&secret_key, &p1)?;
    let c2 = VectorLWE::encrypt(&secret_key, &p2)?;

    // add the two ciphertexts homomorphically

    // decrypt and decode the result
    let m3 = c1.decrypt_decode(&secret_key)?;

    // print the result and compare to non-FHE addition
    println!("Real: {} + {} = {}", m1, m2, m1 + m2);
        "FHE: {} + {} = {}",


This library uses several dependencies and we would like to thank the contributors of those libraries :

We also use some crates published by The Rust Project Developers under the MIT or Apache 2.0 license :


This software is distributed under the AGPL-v3 license. If you have any question, please contact us at hello@zama.ai.


~239K SLoC