Concrete Numpy is an open-source library which simplifies the use of fully homomorphic encryption (FHE).
Project description
Concrete Numpy
Table of contents
Introduction
Concrete Numpy is an open-source library 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 the privacy of the 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.
Installation
The preferred way to install concrete-numpy is through PyPI. To install Concrete Numpy from PyPi, run the following:
pip install concrete-numpy
You can get the concrete-numpy docker image by pulling the latest docker image:
docker pull zamafhe/concrete-numpy:v0.8.0
You can find more detailed installation instructions in installing.md
Getting started
import concrete.numpy as cnp
@cnp.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}")
if you have a function object that you cannot decorate, you can use the explicit Compiler
API instead
import concrete.numpy as cnp
def add(x, y):
return x + y
compiler = cnp.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)
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}")
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for concrete_numpy-0.8.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ed36f54ff9929c35a1f0275b0e155566a125166bca7df82a1db03c5cbbb0cff |
|
MD5 | d2105f300cd0f15cff29233c271da4d8 |
|
BLAKE2b-256 | ede7ae01f4ac101543bcbb95b685a390dfebddf48d848c3954369978d3fe2ca6 |