2022-07-22 12:30:27 +03:00
2022-07-22 12:30:27 +03:00
2022-06-24 19:25:25 +03:00
2022-04-08 12:09:44 +03:00
2022-03-29 09:24:27 +02:00
2022-07-12 12:30:40 +03:00
2021-08-10 09:07:30 +02:00

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.6.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.

Description
No description provided
Readme 148 MiB
Languages
C++ 34.3%
Python 23.1%
MLIR 22.9%
Rust 14.6%
C 2.2%
Other 2.8%