#fully #homomorphic #encryption #fhe #cryptography

concrete-shortint

Homomorphic Short Integer interface for the concrete FHE library

1 unstable release

0.1.0-beta.0 Jul 6, 2022

#916 in Cryptography

Download history 38/week @ 2022-07-06 16/week @ 2022-07-13 22/week @ 2022-07-20 19/week @ 2022-07-27 19/week @ 2022-08-03 18/week @ 2022-08-10 23/week @ 2022-08-17 22/week @ 2022-08-24 29/week @ 2022-08-31 26/week @ 2022-09-07 29/week @ 2022-09-14 23/week @ 2022-09-21 23/week @ 2022-09-28

104 downloads per month
Used in concrete-integer

BSD-3-Clause-Clear and GPL-2.0-or-later

450KB
7K SLoC

concrete Shortint

concrete-shortint is a Rust library based on concrete-core with the goal of providing an abstraction layer that provides "short integer" types.

By "short integer", we mean unsigned integers, with usually less than 8 bits and that fits on a single LWE ciphertext.

The intended target audience for this library is people with cryptography knowledge.

License

This software is distributed under the BSD-3-Clause-Clear license. If you have any questions, please contact us at hello@zama.ai.


lib.rs:

Welcome the the concrete-shortint documentation!

Description

This library makes it possible to execute modular operations over encrypted short integer.

It allows to execute an integer 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.

The server however, has to know the integer circuit to be evaluated. At the end of the computation, the server returns the encryption of the result to the user.

Keys

This crates exposes two type of keys:

  • The [ClientKey] is used to encrypt and decrypt and has to be kept secret;
  • The [ServerKey] is used to perform homomorphic operations on the server side and it is meant to be published (the client sends it to the server).

Quick Example

The following piece of code shows how to generate keys and run a small integer circuit homomorphically.

use concrete_shortint::{gen_keys, Parameters};

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

let msg1 = 1;
let msg2 = 0;

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

// We use the server public key to execute an integer circuit:
let ct_3 = server_key.unchecked_add(&ct_1, &ct_2);

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

Dependencies

~18MB
~426K SLoC