All Projects → tf-encrypted → tf-seal

tf-encrypted / tf-seal

Licence: Apache-2.0 license
Bridge between TensorFlow and the Microsoft SEAL homomorphic encryption library

Programming Languages

C++
36643 projects - #6 most used programming language
python
139335 projects - #7 most used programming language
shell
77523 projects
Makefile
30231 projects
Dockerfile
14818 projects

Projects that are alternatives of or similar to tf-seal

fully-homomorphic-encryption
Libraries and tools to perform fully homomorphic encryption operations on an encrypted data set.
Stars: ✭ 2,737 (+2941.11%)
Mutual labels:  homomorphic-encryption
concrete-numpy
Concrete Numpy is a python package that contains the tools data scientists need to compile various numpy functions into their Fully Homomorphic Encryption (FHE) equivalents. Concrete Numpy goes on top of the Concrete Library and its Compiler.
Stars: ✭ 111 (+23.33%)
Mutual labels:  homomorphic-encryption
Seal
Microsoft SEAL is an easy-to-use and powerful homomorphic encryption library.
Stars: ✭ 2,424 (+2593.33%)
Mutual labels:  homomorphic-encryption
javallier
A Java library for Paillier partially homomorphic encryption.
Stars: ✭ 67 (-25.56%)
Mutual labels:  homomorphic-encryption
elgamalext
Extension for the .NET Framework cryptography subsystem, which introduces the ElGamal public key cryptosystem with support for homomorphic multiplication.
Stars: ✭ 14 (-84.44%)
Mutual labels:  homomorphic-encryption
threshold-signatures
Threshold Signature Scheme for ECDSA
Stars: ✭ 79 (-12.22%)
Mutual labels:  homomorphic-encryption
awesome-secure-computation
Awesome list for cryptographic secure computation paper. This repo includes *Lattice*, *DifferentialPrivacy*, *MPC* and also a comprehensive summary for top conferences.
Stars: ✭ 125 (+38.89%)
Mutual labels:  homomorphic-encryption
libshe
Symmetric somewhat homomorphic encryption library based on DGHV
Stars: ✭ 24 (-73.33%)
Mutual labels:  homomorphic-encryption
gomorph
Implementing Homomorphic Encryption in Golang 🌱
Stars: ✭ 76 (-15.56%)
Mutual labels:  homomorphic-encryption
WeDPR-Lab-Java-SDK
Java SDK of WeDPR-Lab-Core; WeDPR即时可用场景式隐私保护高效解决方案核心算法组件通用Java SDK
Stars: ✭ 18 (-80%)
Mutual labels:  homomorphic-encryption
WeDPR-Lab-Core
Core libraries of WeDPR instant scenario-focused solutions for privacy-inspired business; WeDPR即时可用场景式隐私保护高效解决方案核心算法组件
Stars: ✭ 147 (+63.33%)
Mutual labels:  homomorphic-encryption
federated-learning-poc
Proof of Concept of a Federated Learning framework that maintains the privacy of the participants involved.
Stars: ✭ 13 (-85.56%)
Mutual labels:  homomorphic-encryption
ecelgamal
Additive homomorphic EC-ElGamal
Stars: ✭ 19 (-78.89%)
Mutual labels:  homomorphic-encryption
minionn
Privacy -preserving Neural Networks
Stars: ✭ 58 (-35.56%)
Mutual labels:  homomorphic-encryption
WeDPR-Lab-iOS-SDK
iOS SDK of WeDPR-Lab-Core; WeDPR即时可用场景式隐私保护高效解决方案核心算法组件iOS SDK
Stars: ✭ 13 (-85.56%)
Mutual labels:  homomorphic-encryption
haal
Hääl - Anonymous Electronic Voting System on Public Blockchains
Stars: ✭ 96 (+6.67%)
Mutual labels:  homomorphic-encryption
encrypted-geofence
testing out homomorphic encryption
Stars: ✭ 33 (-63.33%)
Mutual labels:  homomorphic-encryption
federated
Bachelor's Thesis in Computer Science: Privacy-Preserving Federated Learning Applied to Decentralized Data
Stars: ✭ 25 (-72.22%)
Mutual labels:  homomorphic-encryption
node-seal
Homomorphic Encryption for TypeScript or JavaScript - Microsoft SEAL
Stars: ✭ 139 (+54.44%)
Mutual labels:  homomorphic-encryption
he-toolkit
The Intel Homomorphic Encryption (HE) toolkit is the primordial vehicle for the continuous distribution of the Intel HE technological innovation to users. The toolkit has been designed with usability in mind and to make it easier for users to evaluate and deploy homomorphic encryption technology on the Intel platforms.
Stars: ✭ 40 (-55.56%)
Mutual labels:  homomorphic-encryption

TF SEAL

TF SEAL provides a bridge between TensorFlow and the Microsoft SEAL homomorphic encryption library, making it easier than ever to use this library to compute on encrypted data. It currently offers low-level operations for interacting with Microsoft SEAL via TensorFlow with work in progress on a high-level integration into TF Encrypted.

PyPI CircleCI Badge

Usage

The following demonstrates how the low-level interface can be used to perform a matrix multiplication using homomorphic encryption inside of TensorFlow.

import numpy as np
import tensorflow as tf
import tf_seal as tfs

public_keys, secret_key = tfs.seal_key_gen(gen_relin=True, gen_galois=True)

# sample inputs in the form of tf.Tensors
a = tf.random.normal(shape=(2, 3), dtype=tf.float32)
b = tf.random.normal(shape=(2, 3), dtype=tf.float32)

# the plaintext equivalent of our computation
c = tf.matmul(a, tf.transpose(b))

# encrypt inputs, yielding tf_seal.Tensors
a_encrypted = tfs.convert_to_tensor(a, secret_key, public_keys)
b_encrypted = tfs.convert_to_tensor(b, secret_key, public_keys)

# perform computation on encrypted data
# - note that because of how the data is laid out in memory,
#   tf_seal.matmul expects the right-hand matrix to be ordered
#   column-major wise, i.e. already transposed
c_encrypted = tfs.matmul(a_encrypted, b_encrypted)

with tf.Session() as sess:
    expected, actual = sess.run([c, c_encrypted])
    np.testing.assert_almost_equal(actual, expected, decimal=3)

Documentation

Blog posts:

Road map

We are currently working on integrating TF SEAL into TF Encrypted such that privacy-preserving machine learning applications can instead access the library through a high-level interface and take advantage of e.g. the Keras API. This includes adding logic that helps optimize homomorphic encryption for a perticular computation, making use even easier.

Installation

We recommend using Miniconda or Anaconda to set up and use a Python 3.7 environment for all instructions below:

conda create -n tfseal python=3.7 -y
source activate tfseal

After installing the custom build of TensorFlow you can install TF SEAL from PyPI using pip:

pip install tf-seal

Examples

There is currently one example displaying how we can run a simple logistic regression prediction with TF SEAL.

Once TF SEAL is installed we can run the example by simplying running:

python logistic_regression.py

Development

We recommend using Miniconda or Anaconda to set up and use a Python 3.7 environment for all instructions below:

conda create -n tfseal-dev python=3.7 -y
source activate tfseal-dev

The basic requirements are:

The remaining PyPI packages can then be installed using:

pip install -r requirements-dev.txt

Testing

All tests can be run via Bazel with:

make test

Building

The pip package can be built using:

make build

with the resulting wheel file placed in ./artifacts.

Custom TensorFlow

A custom build of TensorFlow is currently needed to run TF SEAL due to a mismatch between the C++ version used by the official TensorFlow build (C++11) and the one needed by Microsoft SEAL (C++17). A patched version of TensorFlow built with C++17 can be installed as shown below.

Ubuntu binary

wget https://storage.googleapis.com/tf-pips/tf-c++17-support/tf_nightly-1.14.0-cp37-cp37m-linux_x86_64.whl
pip install tf_nightly-1.14.0-cp37-cp37m-linux_x86_64.whl

macOS binary

wget https://storage.googleapis.com/tf-pips/tf-c++17-support/tf_nightly-1.14.0-cp37-cp37m-macosx_10_7_x86_64.whl
pip install tf_nightly-1.14.0-cp37-cp37m-macosx_10_7_x86_64.whl

From source

We recommend using Miniconda or Anaconda to first set up and use a Python 3.7 environment:

conda create -n customtf python=3.7 -y
source activate customtf

This requires that Bazel (== 0.26.1) has been installed. The patched version of TensorFlow may then be built using:

git clone https://github.com/tf-encrypted/tf-seal.git
cd tf-seal
pip install -r requirements-customtf.txt

make tensorflow
pip install -U tf_nightly-1.14.0-cp37-cp37m-*
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].