Skip to main content

A state-of-the-art homomorphic encryption framework

Project description

Zama Concrete


📒 Documentation | 💛 Community support | 📚 FHE resources by Zama

About

What is Concrete

Concrete is an open-source FHE Compiler that simplifies the use of fully homomorphic encryption (FHE). Concrete framework contains a TFHE Compiler based on LLVM, making writing FHE programs an easy task for developers.

Fully Homomorphic Encryption (FHE) enables performing computations on encrypted data directly without the need to decrypt it first. FHE allows developers to build services that ensure privacy for all users. FHE is also an excellent solution against data breaches as everything is performed on encrypted data. Even if the server is compromised, no sensitive data will be leaked.

Concrete is a versatile library that can be used for a variety of purposes. For instance, Concrete ML is built on top of Concrete to simplify Machine-Learning oriented use cases.

Table of Contents

Getting Started

Installation

Depending on your OS, Concrete may be installed with Docker or with pip:

OS / HW Available on Docker Available on PyPI
Linux Yes Yes
Windows Yes Coming soon
Windows Subsystem for Linux Yes Yes
macOS 11+ (Intel) Yes Yes
macOS 11+ (Apple Silicon: M1, M2, etc.) Coming soon Yes

Pip

The preferred way to install Concrete is through PyPI:

pip install -U pip wheel setuptools
pip install concrete-python

Docker

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

docker pull zamafhe/concrete-python:v2.0.0

Find more detailed installation instructions in this part of the documentation

↑ Back to top

A simple example

To compute on encrypted data, you first need to define the function you want to compute, then compile it into a Concrete Circuit, which you can use to perform homomorphic evaluation. Here is the full example:

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}")

This example is explained in more detail in this part of the documentation.

↑ Back to top

Resources

Concrete deep dive

Tutorials

Explore more useful resources in Concrete tutorials and Awesome Zama repo. If you have built awesome projects using Concrete, please let us know and we will be happy to showcase them here!

Documentation

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

↑ Back to top

Working with Concrete

Citations

To cite Concrete in academic papers, please use the following entry:

@Misc{Concrete,
  title={{Concrete: TFHE Compiler that converts python programs into FHE equivalent}},
  author={Zama},
  year={2022},
  note={\url{https://github.com/zama-ai/concrete}},
}

Contributing

There are two ways to contribute to Concrete. You can:

  • Open issues to report bugs and typos, or to suggest new ideas
  • Request to become an official contributor by emailing hello@zama.ai.

Becoming an approved contributor involves signing our Contributor License Agreement (CLA)). Only approved contributors can send pull requests (PRs), so get in touch before you do!

Additionally, you can contribute to advancing the FHE space with Zama by participating in our Bounty Program and Grant Programs!

License

This software is distributed under the BSD-3-Clause-Clear. Check for more details

If you have any questions, please contact us at hello@zama.ai.

↑ Back to top

Support

Support

🌟 If you find this project helpful or interesting, please consider giving it a star on GitHub! Your support helps to grow the community and motivates further development.

↑ Back to top

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-2.6.0rc2-cp311-cp311-manylinux_2_28_x86_64.whl (72.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

concrete_python-2.6.0rc2-cp311-cp311-macosx_11_0_x86_64.whl (58.2 MB view details)

Uploaded CPython 3.11macOS 11.0+ x86-64

concrete_python-2.6.0rc2-cp311-cp311-macosx_11_0_arm64.whl (50.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

concrete_python-2.6.0rc2-cp310-cp310-manylinux_2_28_x86_64.whl (72.2 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

concrete_python-2.6.0rc2-cp310-cp310-macosx_11_0_x86_64.whl (58.2 MB view details)

Uploaded CPython 3.10macOS 11.0+ x86-64

concrete_python-2.6.0rc2-cp310-cp310-macosx_11_0_arm64.whl (50.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

concrete_python-2.6.0rc2-cp39-cp39-manylinux_2_28_x86_64.whl (72.2 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.28+ x86-64

concrete_python-2.6.0rc2-cp39-cp39-macosx_11_0_x86_64.whl (58.2 MB view details)

Uploaded CPython 3.9macOS 11.0+ x86-64

concrete_python-2.6.0rc2-cp39-cp39-macosx_11_0_arm64.whl (50.3 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

concrete_python-2.6.0rc2-cp38-cp38-manylinux_2_28_x86_64.whl (72.2 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.28+ x86-64

concrete_python-2.6.0rc2-cp38-cp38-macosx_11_0_x86_64.whl (58.2 MB view details)

Uploaded CPython 3.8macOS 11.0+ x86-64

concrete_python-2.6.0rc2-cp38-cp38-macosx_11_0_arm64.whl (50.3 MB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

File details

Details for the file concrete_python-2.6.0rc2-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for concrete_python-2.6.0rc2-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 74b2826862aa68e6a0fd8c0890926d7f7e48a8838ee663b5250a5c7701e92e67
MD5 68b64deb6078b60196ff56f9b0b9f5d0
BLAKE2b-256 da08c87dbefc7665068dc882bf7cea9b28e9f0956a784731b393ebb427c44b55

See more details on using hashes here.

File details

Details for the file concrete_python-2.6.0rc2-cp311-cp311-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for concrete_python-2.6.0rc2-cp311-cp311-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 20ce7169a8c8c7b5dfecaf786362d39fb9a4f7ada6fe0726678d14758f04306f
MD5 83edf040282d7a8f7f8692c4c0fdc94b
BLAKE2b-256 298ae595ec2909ae2702b166be959d3dd004315a8ee8f11c218d601d759c1fb1

See more details on using hashes here.

File details

Details for the file concrete_python-2.6.0rc2-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for concrete_python-2.6.0rc2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1889cc215700f4d485aff023d587fdef6fe3dbf39e3a66d59ecea655ecc200ce
MD5 97ae51cd970bda00f7373144f1587d40
BLAKE2b-256 28987c748b6c5b20c3297d18d56031b3424bbf6a359ecd4a0744e8cd9f6b60ff

See more details on using hashes here.

File details

Details for the file concrete_python-2.6.0rc2-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for concrete_python-2.6.0rc2-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a94236c5225cee768ce835e362e2329c7dad5b7b58a78e2a9905063e1c2b26ca
MD5 43fd67ec92602057028a741360faa2c7
BLAKE2b-256 9c20e393e65b92da98fc65df801c7884afb2b4a804dabcfeb7aa8cbcd911512e

See more details on using hashes here.

File details

Details for the file concrete_python-2.6.0rc2-cp310-cp310-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for concrete_python-2.6.0rc2-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 dfc8220a93564419f9cb2fef80b6063f995a2ea10854c422e6a2895feda6f6c7
MD5 1018021274242179da98e21351c462b8
BLAKE2b-256 99ad207529abae58b566458af0d651076f648d9a818fa71ff5d1bb0f1b9ac062

See more details on using hashes here.

File details

Details for the file concrete_python-2.6.0rc2-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for concrete_python-2.6.0rc2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 802fc8c32dfb9d54d808b7979477e0b13bad68f920a3fcd96f15e49d7b912f2c
MD5 a3f65f0c22d82722240e19d348877b73
BLAKE2b-256 4c8b90b716dac6ff1ad583f77d94a9f3a530e1525eef19ea2e12abfff1c86296

See more details on using hashes here.

File details

Details for the file concrete_python-2.6.0rc2-cp39-cp39-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for concrete_python-2.6.0rc2-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0335d8ed3f0fff534a1353c9f35c86170b249e968dbbec38267b942e0d8aadfb
MD5 9d247143b1b215c18895b9e01d5a673b
BLAKE2b-256 a40e2cb7b6317fdc5af06eedb43598ae1388c15194d40f094c5fadf2233a5658

See more details on using hashes here.

File details

Details for the file concrete_python-2.6.0rc2-cp39-cp39-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for concrete_python-2.6.0rc2-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 b9bea4cafe8b58c4afa94770c5ad7ca778f7bb13bbda0643598f9c1ed9521911
MD5 6387c6db62415ff26cbd79c6eba53c7c
BLAKE2b-256 bd9325623d93717cb949fe4b6032830b80c717ba3aa6df764135f3390ee3d787

See more details on using hashes here.

File details

Details for the file concrete_python-2.6.0rc2-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for concrete_python-2.6.0rc2-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c250bd1cf7672b4acb271cb3130be5b6bde73601516fcb52d8130616794c4676
MD5 127d342604b8ea8f94ff9624b5ab79ff
BLAKE2b-256 f2a0bf6fce421ec9e2984c338fdbf2c8300fe45d71f596fea7bd34e9b33cabd0

See more details on using hashes here.

File details

Details for the file concrete_python-2.6.0rc2-cp38-cp38-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for concrete_python-2.6.0rc2-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a5f44f199c3116be459e685876833c7a0526d3a689ceebb7423c3f7e00207020
MD5 f171cef18d27e243db24e07161cedd97
BLAKE2b-256 d8872b662914cbee1817e24e82481d84ce641561a03e819b6f9a5aa949a66e49

See more details on using hashes here.

File details

Details for the file concrete_python-2.6.0rc2-cp38-cp38-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for concrete_python-2.6.0rc2-cp38-cp38-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 b38d2f0adb8aaccafa97e9f74c033a03a46c7d1631dd5fd8ca60ac97365d5f97
MD5 aa343fee76f3547e8234f73d23dd1e40
BLAKE2b-256 b041301d6efc18aa74ef48fd67edfad67acdfaaa7caa5a080276cd32e6375356

See more details on using hashes here.

File details

Details for the file concrete_python-2.6.0rc2-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for concrete_python-2.6.0rc2-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 28a3a9c27380d24565d28fa06339a86e5f15bd98fcaa9d1e692621a2c05a4e60
MD5 e1d3a9336d939b6d542cf99d99503ca5
BLAKE2b-256 97416c2a4930f8dc34b39df0eecbdd70e4e5d8179831d169ad1dc584e6963ced

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