Concrete Framework

Concrete makes homomorphic encryption research and development simple, so that you can spend more time building secure software and protocols, and less time figuring out how libraries work. Read our whitepaper here.


Concrete Lib

The concrete library is an ecosystem crates that implements Zama's variant of TFHE. It is implemented using the Rust Programming language, which allows very fast, yet very secure implementations.

As an example, see an example of program that adds two ciphertexts.


use concrete::*;

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;

    // Encode in [0, 10[ with 8 bits of precision and 1 bit of padding
    let encoder = Encoder::new(0., 10., 8, 1)?;

    // encrypt plaintexts
    let mut c1 = LWE::encode_encrypt(&secret_key, m1, &encoder)?;
    let c2 = LWE::encode_encrypt(&secret_key, m2, &encoder)?;

    // add the two ciphertexts homomorphically, and store in c1
    c1.add_with_padding_inplace(&c2)?;

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

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

    Ok(())
}
Copy

Lorem Ipsum Dolor Sit Amet

Lorem ipsum dolor sit amet, et zacarius consectetur adipiscing elit, tempor ut labore et dolore magna aliqua mussum...

Lorem Ipsum Dolor Sit Amet

Lorem ipsum dolor sit amet, et zacarius consectetur adipiscing elit, tempor ut labore et dolore magna aliqua mussum...

Lorem Ipsum Dolor Sit Amet

Lorem ipsum dolor sit amet, et zacarius consectetur adipiscing elit, tempor ut labore et dolore magna aliqua mussum...

Concrete Boolean

This library makes it possible to execute boolean gates over encrypted bits. It allows you to execute a boolean circuit on an untrusted server because both circuit inputs and outputs are kept private. Data are encrypted on the client side before being sent to the server. On the server side every computation is performed on ciphertexts.

Here's a quick example of how the library can be used.

See More Use Cases Here
Copy

extern crate concrete_boolean;
use concrete_boolean::gen_keys;

// We generate a set of client/server keys, using the default parameters:
let (client_key, server_key) = gen_keys();

// We use the client secret key to encrypt two messages:
let ct_1 = client_key.encrypt(true);
let ct_2 = client_key.encrypt(false);

// We use the server public key to execute a boolean circuit:
// if ((NOT ct_2) NAND (ct_1 AND ct_2)) then (NOT ct_2) else (ct_1 AND ct_2)
let ct_3 = server_key.not(&ct_2);
let ct_4 = server_key.and(&ct_1, &ct_2);
let ct_5 = server_key.nand(&ct_3, &ct_4);
let ct_6 = server_key.mux(&ct_5, &ct_3, &ct_4);

// We use the client key to decrypt the output of the circuit:
let output = client_key.decrypt(&ct_6);
assert_eq!(output, true);

Lorem Ipsum Dolor Sit Amet

Lorem ipsum dolor sit amet, et zacarius consectetur adipiscing elit, tempor ut labore et dolore magna aliqua mussum...

Lorem Ipsum Dolor Sit Amet

Lorem ipsum dolor sit amet, et zacarius consectetur adipiscing elit, tempor ut labore et dolore magna aliqua mussum...

Lorem Ipsum Dolor Sit Amet

Lorem ipsum dolor sit amet, et zacarius consectetur adipiscing elit, tempor ut labore et dolore magna aliqua mussum...

Concrete Core

Concrete-core contains a set of fast, low-level primitives which can be used to implement FHE programs. The goal of concrete-core is to be the intermediate layer where library writers and compiler makers can access a breadth of fast primitives developed by researchers and hardware designers.

To the right, here's how the library can be used to encrypt an integer and then decrypt it.


extern crate concrete_core;
extern crate concrete_commons;

use concrete_commons::dispersion::Variance;
use concrete_commons::parameters::LweDimension;
use concrete_core::prelude::*;

// DISCLAIMER: the parameters used here are only for demo purposes, and are not secure.
let lwe_dimension = LweDimension(630);
// Here a hard-set encoding is applied (shift by 20 bits)
let input = 3_u32 << 20;
let noise = Variance(2_f64.powf(-25.));

let mut engine = CoreEngine::new().unwrap();
let key: LweSecretKey32 = engine.create_lwe_secret_key(lwe_dimension).unwrap();
let plaintext = engine.create_plaintext(&input).unwrap();
let ciphertext = engine.encrypt_lwe_ciphertext(&key, &plaintext, noise).unwrap();

let decrypted_plaintext = engine.decrypt_lwe_ciphertext(&key, &ciphertext).unwrap();

engine.destroy(key).unwrap();
engine.destroy(plaintext).unwrap();
engine.destroy(ciphertext).unwrap();
engine.destroy(decrypted_plaintext).unwrap();
Copy

Start using Concrete

RESOURCES

Learn more

Announcing Concrete Core v1.0-beta

We are announcing the release of Concrete-core V1.0.0-beta, getting one step closer towards the 1.0.0 release.

Read Article

Encrypted search using fully homomorphic encryption

An article by Optalysys on implementing an encrypted search operation using Zama’s Concrete Boolean library.

Read Article

Concrete Boolean and Conway’s Game of Life: A Tutorial

A guest article by Optalysys on implementing Conway’s Game of Life using homomorphic encryption.

Read Article