Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Concrete: TFHE Compiler that converts python programs into FHE equivalent

License

NotificationsYou must be signed in to change notification settings

jamestiotio/concrete

 
 

Repository files navigation


📒 Read documentation | 💛 Community support


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 forlarge collection of operators
  • Partial support for floating points
  • Support for table lookups on integers
  • Support for integration with Client / Server architectures

Installation

OS / HWAvailable on DockerAvailable on PyPI
LinuxYesYes
WindowsYesComing soon
Windows Subsystem for LinuxYesYes
macOS 11+ (Intel)YesYes
macOS 11+ (Apple Silicon: M1, M2, etc.)YesYes

The preferred way to install Concrete is through PyPI:

pip install -U pip wheel setuptoolspip install concrete-python

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

docker pull zamafhe/concrete-python:v2.0.0

You can find more detailed installation instructions ininstalling.md

Getting started

fromconcreteimportfhedefadd(x,y):returnx+ycompiler=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)]forexampleinexamples: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:

fromconcreteimportfhe@fhe.compiler({"x":"encrypted","y":"encrypted"})defadd(x,y):returnx+yinputset= [(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)]forexampleinexamples:result=circuit.encrypt_run_decrypt(*example)print(f"Evaluation of{' + '.join(map(str,example))} homomorphically ={result}")

Documentation

Full, comprehensive documentation is available athttps://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 isConcrete 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 apython frontend.
  • compilers directory contains theconcrete-compiler andconcrete-optimizer modules.concrete-compiler is a compiler that:
    • synthetize a FHE computation dag expressed as aMLIR 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.
  • Thebackends directory contains implementations of cryptographic primitives on different computation unit, used byconcrete-compiler runtime.concrete-cpu module provides CPU implementation, whileconcrete-cuda module provides GPU implementation using the CUDA platform.
  • Thetools directory contains side tools used by the rest of the project.

Need support?

Citing Concrete

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}},}

License

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

About

Concrete: TFHE Compiler that converts python programs into FHE equivalent

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++51.8%
  • MLIR16.0%
  • Python12.0%
  • Cuda10.8%
  • Rust6.8%
  • C1.5%
  • Other1.1%

[8]ページ先頭

©2009-2025 Movatter.jp