Skip to main content

A state-of-the-art homomorphic encryption framework

Project description


📒 Read documentation | 💛 Community support


:warning: Starting from v1, Concrete Rust Libraries are now deprecated and replaced by TFHE-rs, Concrete is now, exclusively, Zama TFHE Compiler. Read full announcement here

Concrete is an open-source FHE Compiler which simplifies the use of fully homomorphic encryption (FHE).

FHE is a powerful cryptographic tool, which allows computation to be performed directly on encrypted data without needing to decrypt it first. With FHE, you can build services that preserve privacy for all users. FHE is also great against data breaches as everything is done on encrypted data. Even if the server is compromised, in the end no sensitive data is leaked.

Since writing FHE programs can be difficult, Concrete, based on LLVM, make this process easier for developers.

Main features

  • Ability to compile Python functions (that may include NumPy) to their FHE equivalents, to operate on encrypted data
  • Support for large collection of operators
  • Partial support for floating points
  • Support for table lookups on integers
  • Support for integration with Client / Server architectures

Installation

OS / HW Available on Docker Available on PyPI
Linux Yes Yes
Windows Yes No
Windows Subsystem for Linux Yes Yes
macOS (Intel) Yes Yes
macOS (Apple Silicon) Yes Yes

The preferred way to install Concrete is through PyPI:

pip install concrete-python

You can get the concrete-python docker image by pulling the latest docker image:

docker pull zamafhe/concrete-python:v1.0.0

You can find more detailed installation instructions in installing.md

Getting started

from concrete import fhe

def add(x, y):
    return x + y

compiler = fhe.Compiler(add, {"x": "encrypted", "y": "encrypted"})
inputset = [(2, 3), (0, 0), (1, 6), (7, 7), (7, 1), (3, 2), (6, 1), (1, 7), (4, 5), (5, 4)]

print(f"Compiling...")
circuit = compiler.compile(inputset)

print(f"Generating keys...")
circuit.keygen()

examples = [(3, 4), (1, 2), (7, 7), (0, 0)]
for example in examples:
    encrypted_example = circuit.encrypt(*example)
    encrypted_result = circuit.run(encrypted_example)
    result = circuit.decrypt(encrypted_result)
    print(f"Evaluation of {' + '.join(map(str, example))} homomorphically = {result}")

or if you have a simple function that you can decorate, and you don't care about explicit steps of key generation, encryption, evaluation and decryption:

from concrete import fhe

@fhe.compiler({"x": "encrypted", "y": "encrypted"})
def add(x, y):
    return x + y

inputset = [(2, 3), (0, 0), (1, 6), (7, 7), (7, 1), (3, 2), (6, 1), (1, 7), (4, 5), (5, 4)]

print(f"Compiling...")
circuit = add.compile(inputset)

examples = [(3, 4), (1, 2), (7, 7), (0, 0)]
for example in examples:
    result = circuit.encrypt_run_decrypt(*example)
    print(f"Evaluation of {' + '.join(map(str, example))} homomorphically = {result}")

Documentation

Full, comprehensive documentation is available at https://docs.zama.ai/concrete.

Target users

Concrete is a generic library that supports a variety of use cases. Because of this flexibility, it doesn't provide primitives for specific use cases.

If you have a specific use case, or a specific field of computation, you may want to build abstractions on top of Concrete.

One such example is Concrete ML, which is built on top of Concrete to simplify Machine Learning oriented use cases.

Tutorials

Various tutorials are proposed in the documentation to help you start writing homomorphic programs:

If you have built awesome projects using Concrete, feel free to let us know and we'll link to it.

Project layout

concrete project is a set of several modules which are high-level frontends, compilers, backends and side tools.

  • frontends directory contains a python frontend.
  • compilers directory contains the concrete-compiler and concrete-optimizer modules. concrete-compiler is a compiler that:
    • synthetize a FHE computation dag expressed as a MLIR dialect
    • compile to a set of artifacts
    • and provide tools to manipulate those artifacts at runtime. concrete-optimizer is a specific module used by the compiler to find the best, secure and accurate set of cryptographic parameters for a given dag.
  • The backends directory contains implementations of cryptographic primitives on different computation unit, used by concrete-compiler runtime. concrete-cpu module provides CPU implementation, while concrete-cuda module provides GPU implementation using the CUDA platform.
  • The tools directory contains side tools used by the rest of the project.

Need support?

License

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

concrete_python-1.1.0rc1-cp311-cp311-manylinux_2_28_x86_64.whl (63.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

concrete_python-1.1.0rc1-cp311-cp311-macosx_11_0_x86_64.whl (48.2 MB view details)

Uploaded CPython 3.11macOS 11.0+ x86-64

concrete_python-1.1.0rc1-cp311-cp311-macosx_11_0_arm64.whl (41.9 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

concrete_python-1.1.0rc1-cp310-cp310-manylinux_2_28_x86_64.whl (63.1 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

concrete_python-1.1.0rc1-cp310-cp310-macosx_11_0_x86_64.whl (48.2 MB view details)

Uploaded CPython 3.10macOS 11.0+ x86-64

concrete_python-1.1.0rc1-cp310-cp310-macosx_11_0_arm64.whl (41.9 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

concrete_python-1.1.0rc1-cp39-cp39-manylinux_2_28_x86_64.whl (63.1 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.28+ x86-64

concrete_python-1.1.0rc1-cp39-cp39-macosx_11_0_x86_64.whl (48.2 MB view details)

Uploaded CPython 3.9macOS 11.0+ x86-64

concrete_python-1.1.0rc1-cp39-cp39-macosx_11_0_arm64.whl (41.9 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

concrete_python-1.1.0rc1-cp38-cp38-manylinux_2_28_x86_64.whl (63.1 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.28+ x86-64

concrete_python-1.1.0rc1-cp38-cp38-macosx_11_0_x86_64.whl (48.2 MB view details)

Uploaded CPython 3.8macOS 11.0+ x86-64

concrete_python-1.1.0rc1-cp38-cp38-macosx_11_0_arm64.whl (41.9 MB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

File details

Details for the file concrete_python-1.1.0rc1-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for concrete_python-1.1.0rc1-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e8bfac36b3a4fd8e2d35a31f29a69ea133ac265147960a0cebcdf85b9f7ea343
MD5 b7c51e536555548874e34f82e33fe7da
BLAKE2b-256 379c06a8831421a438736bc58d457b1ee1e4c088a5242f5e3c4956a579844a6f

See more details on using hashes here.

File details

Details for the file concrete_python-1.1.0rc1-cp311-cp311-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for concrete_python-1.1.0rc1-cp311-cp311-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 de61ea22b00362f1e2c579bf8ce87d3a82b357fcd38b68ec5bd59e65ab49df8c
MD5 8f475c206e0541064da6dd9e5a5eb83b
BLAKE2b-256 bb67dd978ab846c3640b8025b8f4c4ed419cae72f6e64ff788f6317c85b38211

See more details on using hashes here.

File details

Details for the file concrete_python-1.1.0rc1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for concrete_python-1.1.0rc1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8210c457d89cd74d69ab12ac940d1081dc6e71bf57d236fdff009837fbc6b371
MD5 495992fbf19bacb12988814939e3ca41
BLAKE2b-256 122fa3e10a38a0e4a2f9d20c76a9e4ca9462c7fd8ecae8508eea769d021f68cb

See more details on using hashes here.

File details

Details for the file concrete_python-1.1.0rc1-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for concrete_python-1.1.0rc1-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 bd3e7256dcf511c0ce7a9bdf143969409ce880752fa34a525b3aa901a8aa06ee
MD5 3e31bf1024f0d540d894c518cf7db5bd
BLAKE2b-256 04bbdcfc2b19acf35eaa81edac01e4476ce177a09bfe2aebae01e14b2771c266

See more details on using hashes here.

File details

Details for the file concrete_python-1.1.0rc1-cp310-cp310-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for concrete_python-1.1.0rc1-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 b1200afc02810bbaec3141c29aafec4f6ae70cf444d32d43ec97e5fcaa3970ea
MD5 1fa6432d59f7480490e27d511b8f5e6c
BLAKE2b-256 368f039e52acd55114c29be7ee0fb6d0586726c06ec231a4968ca6e0566eaa6d

See more details on using hashes here.

File details

Details for the file concrete_python-1.1.0rc1-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for concrete_python-1.1.0rc1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f112dfd7dea22c05b800cd3393b0d88ebe6afeed492e9d49f5fd61769d0b1e67
MD5 2a925d1a76842bbf5c269f5f991e0251
BLAKE2b-256 503fe072348766458f08030ec8787dc90028de5fe647cb27c603bfcdd63c3b88

See more details on using hashes here.

File details

Details for the file concrete_python-1.1.0rc1-cp39-cp39-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for concrete_python-1.1.0rc1-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d003dafde01f53fee1525bd135f9d439752df247aeadbbdf8ce720196efacfe8
MD5 652abd478e4e6f08b6a83712594c7648
BLAKE2b-256 498caeb180960ccd190ac8261ece2faf27e3277f22543e3a4a707e73b2e99cdb

See more details on using hashes here.

File details

Details for the file concrete_python-1.1.0rc1-cp39-cp39-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for concrete_python-1.1.0rc1-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 11903784a06f37c7521ee01f2ea2087cc0fc4cb6ee728c5964e49244ddca9700
MD5 ebde7a15b6547504df5b44333a2662c5
BLAKE2b-256 16697a6511983f929fb3496ba3967fd32537d3b9b3740e506b07bdbbc2abfbba

See more details on using hashes here.

File details

Details for the file concrete_python-1.1.0rc1-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for concrete_python-1.1.0rc1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9ea59c0977e005496144a47654028dba21ed95b5585ef6b7f29760bf5478275b
MD5 032099c0d342ec3ff08639e83f75590a
BLAKE2b-256 43c8e1097910663aa6565771fe6a4b9bb767622586c80874fc39a53f3e90f80a

See more details on using hashes here.

File details

Details for the file concrete_python-1.1.0rc1-cp38-cp38-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for concrete_python-1.1.0rc1-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 564caeaf717b1117dd2f1061f1ed7fb9c850feb16c0b8667c6d8100c9c8155c7
MD5 d536871d6a39a647d6c05343ba933cb3
BLAKE2b-256 a57fa8cdce892a45e24f05a930d453018c845b35225e221c74ec40e61680145d

See more details on using hashes here.

File details

Details for the file concrete_python-1.1.0rc1-cp38-cp38-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for concrete_python-1.1.0rc1-cp38-cp38-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 4442d6f445129251dd5151124c7c490ab16fe9361b9aec3d3b888e8e6a491cf0
MD5 7e84386269d5fdaa4e4bda89adb76342
BLAKE2b-256 bd802af01d798b322380cdb15ad42425e8698220ce0f5764541120e89bfa4b01

See more details on using hashes here.

File details

Details for the file concrete_python-1.1.0rc1-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for concrete_python-1.1.0rc1-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 85f93e74ccf8d80d10ceeaed1d3c833663c202dd1f47b8ffb64b3b9caa5fdf6f
MD5 2d9c423b0802a7b1beab57a727c85780
BLAKE2b-256 bcbed2e7519ae8648db51b6df683f10ad1b9f994ad083da5aacee74906d3b9da

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page