Concrete Core
This crate contains low-level implementations of homomorphic operators used in the
concrete
library.
⚠ Warning ⚠
This crate assumes that the user is comfortable with the theory behind FHE. If you prefer to use a
simpler API, that will perform sanity checks on your behalf, the higher-level concrete
crate should have your back.
Example
Here is a small example of how one could use concrete-core
to perform a simple operation
homomorphically:
// This examples shows how to multiply a secret value by a public one homomorphically. First
// we import the proper symbols:
use ;
use LweSecretKey;
use LweDimension;
use LweCiphertext;
use LogStandardDev;
// We initialize an encoder that will allow us to turn cleartext values into plaintexts.
let encoder = RealEncoder;
// Our secret value will be 10.,
let cleartext = Cleartext;
let public_multiplier = Cleartext;
// We encode our cleartext
let plaintext = encoder.encode;
// We generate a new secret key which is used to encrypt the message
let secret_key_size = LweDimension;
let secret_key = generate;
// We allocate a ciphertext and encrypt the plaintext with a secure parameter
let mut ciphertext = allocate;
secret_key.encrypt_lwe;
// We perform the homomorphic operation:
ciphertext.update_with_scalar_mul;
// We decrypt the message
let mut output_plaintext = Plaintext;
secret_key.decrypt_lwe;
let output_cleartext = encoder.decode;
// We check that the result is as expected !
assert_eq!;
License
This software is distributed under the BSD-3-Clause-Clear license. If you have any questions,
please contact us at hello@zama.ai
.