Giter Club home page Giter Club logo

tfhe's People

Contributors

isaksundesingh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

tfhe's Issues

Allow different bit-security

Feature request โšก

Allow other security levels.

Is your feature request related to a problem? ๐Ÿ˜ง

Currently, a single parameter-set is returned when creating encryption parameters. There should be different security levels available.

Describe the solution you'd like ๐Ÿ˜„

A way to create a different parameter set, if only discrete sets are allowed, the following would be satisfactory:

use tfhe::{Parameters, SecurityLevel, generate_keys};
let default_parameters = Parameters::default(); // Standard security level (highest possible)
let bit128_parameters = Parameters::with(SecurityLevel::Bit128); // 128-bit security
let bit80_parameters = Parameters::with(SecurityLevel::Bit80); // A lower, 80-bit security level
let keys = generate_keys(bit80_parameters);
...

Improve tests

Feature request โšก

Is your feature request related to a problem? ๐Ÿ˜ง

The tests need cleanup, some tests can be merged, and performance can be improved by caching generated keys (as long as the key generation is tested properly).

Describe the solution you'd like ๐Ÿ˜„

These two tests can be merged as key generation happens twice, without any need for it. They also test the same functionality:

#[test]
fn test_encrypt_decrypt_true_is_true() {
let message = true;
let security = 128;
let params = bootstrapping_parameters(security);
let (secret_key, _cloud_key) = generate_keys(&params);
let encrypted = encrypt(message, &secret_key);
let decrypted = decrypt(&encrypted, &secret_key);
assert_eq!(message, decrypted);
}
#[test]
fn test_encrypt_decrypt_false_is_false() {
let message = false;
let security = 128;
let params = bootstrapping_parameters(security);
let (secret_key, _cloud_key) = generate_keys(&params);
let encrypted = encrypt(message, &secret_key);
let decrypted = decrypt(&encrypted, &secret_key);
assert_eq!(message, decrypted);
}

Increase developer-friendliness

Feature request โšก

Is your feature request related to a problem? ๐Ÿ˜ง

Creating circuits using functions for boolean gates is difficult and manual labour. There could easily be APIs for parsing some DSL and creating circuits for you. At least some prebuilt circuits such as an 8-bit adder. Additionally, common types represented as ciphertexts could be created, such as Uint8.

Describe the solution you'd like ๐Ÿ˜„

Some sort of easier way of creating programs using the library. Some functionality to parse a binary circuit language would be helpful. A compiler for converting Rust or LLVM to circuits would be even better.

Describe alternatives ๐Ÿคทโ€โ™‚๏ธ

Possible solutions could be:

  • A parser for converting binary circuit formats to the encrypted form. E.g. some subset of Verilog or similar.
  • A compiler for converting Rust to circuits
  • A DSL for writing circuits.
  • Some predefined built-in primitive types. E.g. Uint8, Int8, etc. with associated common methods / structures, e.g. 8-bit adder, encrypted comparison circuit, etc.

Clean up public API

Feature request โšก

Is your feature request related to a problem? ๐Ÿ˜ง

As of now, the public API is a bit of a mess. Many things that should not be public are public, and all modules are public. Functions, methods, types, traits, etc. should be at the lowest visibility level unless required to be public.

Additionally, there is no good structure to the API. Encryption, decryption and key generation is in the bootstrapping-module instead of some encryption module or preferably as part of the prelude or exposed at the root-level.

Describe the solution you'd like ๐Ÿ˜„

An expected public API structure could look something like:

  • tfhe - Exposes encrypt, decrypt, generate_keys
    • encryption - Contains definitions for and exposes encrypt, decrypt and generate_keys
    • bootstrapping - Exposes the bootstrap-method (currently named tfhe_bootstrap which is unnecessary`
    • gates - Exposing all homomorphic gates, which should be named xor instead of boots_xor unless there are any name conflicts. Alternatively, gates could contain all gates without bootstrapping applied, and another module called bootstrapped_gates or perhaps in bootstrapping could contain gates which are bootstrapped. To give the user flexibility to choose between bootstrapped gates and bootstrapped circuits.

That's it. It does not need to be any more than that.

Describe alternatives ๐Ÿคทโ€โ™‚๏ธ

There are probably alternatives to this structure. Some say that https://github.com/dalek-cryptography/curve25519-dalek has a nice API, but I am unsure how this relates to this kind of a library which has more functionality.

The bootstrapping functionality could be done more elegant than feature flags. Currently, the bootstrapping function is exposed even when the bootstrapping-feature is disabled, which is confusing. It would at least make sense to only expose it when the feature is enabled, but a better approach would be something like the structure described in the previous section.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.