Skip to main content

A state-of-the-art homomorphic encryption framework

Project description


📒 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

🌟 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.0rc1-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.0rc1-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.0rc1-cp311-cp311-macosx_11_0_arm64.whl (50.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

concrete_python-2.6.0rc1-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.0rc1-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.0rc1-cp310-cp310-macosx_11_0_arm64.whl (50.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

concrete_python-2.6.0rc1-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.0rc1-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.0rc1-cp39-cp39-macosx_11_0_arm64.whl (50.3 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

concrete_python-2.6.0rc1-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.0rc1-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.0rc1-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.0rc1-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for concrete_python-2.6.0rc1-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 50d8a2718378c16ee5fc66fa3ad843e715a6f05be49e5c8c7eb01dda3df643a2
MD5 3c1697353a5ab329423a1e050ca4e868
BLAKE2b-256 946bcedea8b85058d2eb41e36d746d73e88f91e346395ec31cad7c1a2d59d931

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for concrete_python-2.6.0rc1-cp311-cp311-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 8c5314208719ceb6b5b15894c1e045517803bdbfa769b8cdfcd5089738bb26ee
MD5 16beecb550db77e41dcd345d4cfd863b
BLAKE2b-256 063b77b2097bf029cc060b761a533282c433f009e44d394a434e8cea14e0c07c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for concrete_python-2.6.0rc1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fc7be5056d4688d487cc9c73fb050609a254505af7c2d8daf881586666b3d4d1
MD5 f99f61a09f2ca086459a901c0e6132f7
BLAKE2b-256 1225d55be504cf4d29fe785860233bb32efd858cc03f3e0b20edbe7fa43dbed8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for concrete_python-2.6.0rc1-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8dfb7d3fde6109fc5933cb49ed1287eefb558a7e7a2a6f9ebe3afad95153f2f7
MD5 7519ebf655024e0276570fb7d96068dd
BLAKE2b-256 b6c99fd9d90bf437e1fe8e44709cad155864cc6dc6556abf8f5dbab05db354a7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for concrete_python-2.6.0rc1-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 33567f24e4e1b2e127d3f1519d8f3c1dec25f3a770926f8466c11eed07f238a3
MD5 8dbb86e07a6b95814c38a77ec4343d08
BLAKE2b-256 7102ddbf884ddb04e2714d603d24f74ca0eefc109353ce1d7c89cbf34f69e232

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for concrete_python-2.6.0rc1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3cc220d6f74d79704a0f77e394f3587d62fd00feb5aeb70edb6db7c55e4535a8
MD5 b1d3c2ff7b86ad183b36d7f84aa9021a
BLAKE2b-256 52f3f8aa164678825d606e001578eea851c4d76b8871c657041440e09d50977c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for concrete_python-2.6.0rc1-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9fe0fb1f031fb2432720b5bc588d55077c26bbce36b3e9bb59ba27bd2e21833c
MD5 2b0fa4927b58e8d3d8e2aa87991062fc
BLAKE2b-256 7391d365f83f299187a48039c53174fa70a40be85efe087539c602ebc539fda9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for concrete_python-2.6.0rc1-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 8a1404c66d02760494142cc7780665b28147cfcd41a24bd8a71133b20f4b0597
MD5 f945837105dad3bdddf4a2c32dedd559
BLAKE2b-256 88fd6c11c13fd3f3c662a776608b428f2a24d061c34440cd55741406408a37b8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for concrete_python-2.6.0rc1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 76ca78df116f4dcf1cb2d584fdaf51621ed548f9cbb6608ed04878d6c66f748b
MD5 8783fda5c75b63c59afad9bf8823d3ae
BLAKE2b-256 901bef1b5017a0ab770ddea49d5391dd2e12c934dfada2c6cd59dd25bcddc8c0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for concrete_python-2.6.0rc1-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 98505a7b4e34698590783a49b28a8b23c2b4433b90ed95c478c2d2fa68250698
MD5 cd3e90dbd215d54e375bf410b8b6ed13
BLAKE2b-256 976a8b054fd5b66c4bf6b45c2112bf74ff58abcad5bb0717ba95c904d9a351d9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for concrete_python-2.6.0rc1-cp38-cp38-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 1fa04bd97bac7c71101c3a6f9dfdc7bc9dab232773b811e7c148ed44a61a307c
MD5 4b6f82751337be51adfc16fd8654052c
BLAKE2b-256 50aac4b071526fe2ea6b7b30ce0a934995914c077e3d420268138eb6b5db74c1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for concrete_python-2.6.0rc1-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 69fa7ef4e02655d07d71d88782636a79d7253967841ce10d8b500d56dd220963
MD5 1b5ab56a16dd515c0157ae0089a3aabe
BLAKE2b-256 146d9316a661a96ee054d2d8030ddf76a0677a00b065b84981a985fce0305654

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