All Projects → OpenMined → Tenseal

OpenMined / Tenseal

Licence: apache-2.0
A library for doing homomorphic encryption operations on tensors

Programming Languages

python
139335 projects - #7 most used programming language
cpp
1120 projects

Projects that are alternatives of or similar to Tenseal

Cli
🧰 A zero trust swiss army knife for working with X509, OAuth, JWT, OATH OTP, etc.
Stars: ✭ 2,151 (+991.88%)
Mutual labels:  cryptography, encryption
Kes
KES is a simple, stateless and distributed key-management system
Stars: ✭ 168 (-14.72%)
Mutual labels:  cryptography, encryption
Container
HedgeDoc container image resources
Stars: ✭ 149 (-24.37%)
Mutual labels:  hacktoberfest, docker-image
Torchbear
🔥🐻 The Speakeasy Scripting Engine Which Combines Speed, Safety, and Simplicity
Stars: ✭ 128 (-35.03%)
Mutual labels:  hacktoberfest, cryptography
Sboot stm32
Secure USB DFU1.1 bootloader for STM32
Stars: ✭ 181 (-8.12%)
Mutual labels:  cryptography, encryption
Demo Twilio Backend Nodejs
A sample backend that demonstrates how to generate a Virgil JWT and Twilio token used for authentication with the Virgil and Twilio services
Stars: ✭ 128 (-35.03%)
Mutual labels:  cryptography, encryption
Emberclear
Encrypted Chat. No History. No Logs.
Stars: ✭ 157 (-20.3%)
Mutual labels:  hacktoberfest, encryption
Cryptogotchas
A collection of common (interesting) cryptographic mistakes.
Stars: ✭ 118 (-40.1%)
Mutual labels:  cryptography, encryption
Cryptag
Encrypted, taggable, searchable cloud storage
Stars: ✭ 178 (-9.64%)
Mutual labels:  cryptography, encryption
Magicpad
MagicPad is an encryption suite for beginners. It is designed to be run standalone via the browser or executable (Electron).
Stars: ✭ 174 (-11.68%)
Mutual labels:  cryptography, encryption
Foundryvtt Docker
An easy-to-deploy Dockerized Foundry Virtual Tabletop server.
Stars: ✭ 123 (-37.56%)
Mutual labels:  hacktoberfest, docker-image
Gun
An open source cybersecurity protocol for syncing decentralized graph data.
Stars: ✭ 15,172 (+7601.52%)
Mutual labels:  cryptography, encryption
Noise
.NET Standard 1.3 implementation of the Noise Protocol Framework (revision 33 of the spec)
Stars: ✭ 124 (-37.06%)
Mutual labels:  cryptography, encryption
Padding Oracle Attacker
🔓 CLI tool and library to execute padding oracle attacks easily, with support for concurrent network requests and an elegant UI.
Stars: ✭ 136 (-30.96%)
Mutual labels:  cryptography, encryption
Chest
Bash glue to encrypt and hide files
Stars: ✭ 123 (-37.56%)
Mutual labels:  cryptography, encryption
Discordcrypt
End-To-End File & Message Encryption For Discord
Stars: ✭ 150 (-23.86%)
Mutual labels:  cryptography, encryption
Gitpass
Open Source Your Password (Mismanagement)!
Stars: ✭ 113 (-42.64%)
Mutual labels:  cryptography, encryption
Open Crypto
🔑 Hashing (BCrypt, SHA2, HMAC), encryption (AES), public-key (RSA), and random data generation.
Stars: ✭ 115 (-41.62%)
Mutual labels:  cryptography, encryption
Docker Android Sdk
Stars: ✭ 171 (-13.2%)
Mutual labels:  hacktoberfest, docker-image
Seal
Microsoft SEAL is an easy-to-use and powerful homomorphic encryption library.
Stars: ✭ 2,424 (+1130.46%)
Mutual labels:  cryptography, encryption

TenSEAL

Tests Linux Package MacOS Package Windows Package Docker Image

TenSEAL is a library for doing homomorphic encryption operations on tensors, built on top of Microsoft SEAL. It provides ease of use through a Python API, while preserving efficiency by implementing most of its operations using C++.

Features

  • 🔑 Encryption/Decryption of vectors of integers using BFV
  • 🗝 Encryption/Decryption of vectors of real numbers using CKKS
  • 🔥 Element-wise addition, substraction and multiplication of encrypted-encrypted vectors and encrypted-plain vectors
  • 🌀 Dot product and vector-matrix multiplication
  • ⚡️ Complete SEAL API under tenseal.sealapi

Usage

We show the basic operations over encrypted data, more advanced usage for machine learning applications can be found on our tutorial section

import tenseal as ts

# Setup TenSEAL context
context = ts.context(
            ts.SCHEME_TYPE.CKKS,
            poly_modulus_degree=8192,
            coeff_mod_bit_sizes=[60, 40, 40, 60]
          )
context.generate_galois_keys()
context.global_scale = 2**40

v1 = [0, 1, 2, 3, 4]
v2 = [4, 3, 2, 1, 0]

# encrypted vectors
enc_v1 = ts.ckks_vector(context, v1)
enc_v2 = ts.ckks_vector(context, v2)

result = enc_v1 + enc_v2
result.decrypt() # ~ [4, 4, 4, 4, 4]

result = enc_v1.dot(enc_v2)
result.decrypt() # ~ [10]

matrix = [
  [73, 0.5, 8],
  [81, -5, 66],
  [-100, -78, -2],
  [0, 9, 17],
  [69, 11 , 10],
]
result = enc_v1.matmul(matrix)
result.decrypt() # ~ [157, -90, 153]

Installation

Using pip

$ pip install tenseal

This installs the last packaged version on pypi. If your platform doesn't have a ready package, please open an issue to let us know.

Build from Source

Supported platforms and their requirements are listed below: (this are only required for building TenSEAL from source)

  • Linux: A modern version of GNU G++ (>= 6.0) or Clang++ (>= 5.0).
  • MacOS: Xcode toolchain (>= 9.3)
  • Windows: Microsoft Visual Studio (>= 10.0.40219.1, Visual Studio 2010 SP1 or later).

If you want to install tenseal from the repository, you should first make sure to have the requirements for your platform (listed above) and CMake (3.12 or higher) installed, then get the third party libraries (if you didn't already) by running the following command from the root directory of the project

$ git submodule init
$ git submodule update

TenSEAL uses Protocol Buffers for serialization, and you will need the protocol buffer compiler too.

If you are on Windows, you will first need to build SEAL library using Visual Studio, you should use the solution file SEAL.sln in third_party/SEAL to build the project native\src\SEAL.vcxproj with Configuration=Release and Platform=x64. For more details check the instructions in Building Microsoft SEAL

You can then trigger the build and the installation

$ pip install .

Use Docker

You can use our Docker image for a ready to use environment with TenSEAL installed

$ docker container run --interactive --tty openmined/tenseal

Note: openmined/tenseal points to the image from the last release, use openmined/tenseal:dev for the image built from the master branch.

You can also build your custom image, this might be handy for developers working on the project

$ docker build -t tenseal -f docker-images/Dockerfile-py38 .

To interactively run this docker image as a container after it has been built you can run

$ docker container run -it tenseal

Using Bazel

To use this library in another Bazel project, add the following in your WORKSPACE file:


git_repository(
   name = "org_openmined_tenseal",
   remote = "https://github.com/OpenMined/TenSEAL",
   branch = "master",
   init_submodules = True,
)

load("@org_openmined_tenseal//tenseal:preload.bzl", "tenseal_preload")

tenseal_preload()

load("@org_openmined_tenseal//tenseal:deps.bzl", "tenseal_deps")

tenseal_deps()

Benchmarks

You can benchmark the implementation at any point by running

$ bazel run -c opt --spawn_strategy=standalone //tests/cpp/benchmarks:benchmark

Support

For support in using this library, please join the #lib_tenseal Slack channel. If you’d like to follow along with any code changes to the library, please join the #code_tenseal Slack channel. Click here to join our Slack community!

Tutorials

License

Apache License 2.0

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