3 releases

0.1.1 Nov 16, 2022
0.1.0 Oct 19, 2022
0.1.0-beta.0 Jul 6, 2022

#2356 in Cryptography

Download history 2/week @ 2024-02-11 12/week @ 2024-02-18 36/week @ 2024-02-25 9/week @ 2024-03-03 15/week @ 2024-03-10 10/week @ 2024-03-17 12/week @ 2024-03-24 40/week @ 2024-03-31

78 downloads per month
Used in 2 crates

BSD-3-Clause-Clear

500KB
8K 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

~6.5MB
~127K SLoC