TNO MPC Lab - Paillier

Overview

TNO MPC Lab - Paillier

The TNO MPC lab consists of generic software components, procedures, and functionalities developed and maintained on a regular basis to facilitate and aid in the development of MPC solutions. The lab is a cross-project initiative allowing us to integrate and reuse previously developed MPC functionalities to boost the development of new protocols and solutions.

The package paillier is part of the TNO Go Toolbox.

Limitations in (end-)use: the content of this repository may solely be used for applications that comply with international export control laws.

Paillier cryptosystem

This library is an implementation of the Paillier homomorphic encryption scheme in Go.

Usage

To generate a Paillier private key, use GenerateKey:

	sk, err := paillier.GenerateKey(2048)
	if err != nil {
		t.Fatalf("Error generating key: %v", err)
	}

You can extract the public key from the returned structure, and send it safely to others.

	pk := sk.PublicKey

To encrypt data, use the Encrypt method on a public or private key. You can also compute with encrypted data by using the Add and Mul methods.

	m1 := big.NewInt(10)
	m2 := big.NewInt(15)
	sum := new(big.Int).Add(m1, m2)

	ct1 := pk.Encrypt(m1)

	ct2 := pk.Encrypt(m2)

	ctSum := pk.Add(ct1, ct2)

	decryptedSum := sk.Decrypt(ctSum)

	// decryptedSum.Cmp(sum) == 0

The Paillier cryptosystem allows you to randomize ciphertexts. This is necessary, since otherwise, certain meaningful values (e.g. 0) would be easy to recognize if they result from a computation, even by persons without the private key. You can use the Randomize method to re-randomize any ciphertext.

Since random data is expensive in terms of time, the package comes with a facility to pre-compute randomness. If you need to encrypt large data sets, but not very often, you can speed up encryption by keeping a buffer of randomness that is replenished after you are done with encrypting the data set. See documentation on the NewPrecomputeBuffer function for information on how to use it.

Both the precompute buffer and the public key implement the Encrypter interface, which you can use in your software to transparently work with either plain keys or keys with a buffer attached.

Releases(v1.0.2)
Owner
TNO - MPC Lab
TNO - MPC Lab
TNO - MPC Lab
Concurrency Lab 2 Go Example

Concurrency Lab 2 If you're stuck look at examples on Go by Example Using the lab sheet There are two ways to use the lab sheet, you can either: creat

null 0 Oct 12, 2021
Concurrency Lab 1 Go Example

Concurrency Lab 1 If you're stuck look at examples on Go by Example Using the lab sheet There are two ways to use the lab sheet, you can either: creat

null 0 Oct 11, 2021
A simple and sussy project is an implementation of SOMMIP Lab 1 written in Golang

SOMMIP Lab 1 Isac Arthur Table of Contents About The Project Getting Started Prerequisites Installation Supported commands About The Project This very

Arthur 1 Nov 10, 2021
mit 6.824 lab

lab-6.824 0. How to run? go版本: 1.13+ 在高于1.11的版本中报unexpected directory layout, 但是用较低版本goLand无法调试... unexpected dir layout 原因是不支持相对路径包引入, 遇到时在import 删掉.

JinyuChata 1 Dec 9, 2021
learn mit 6.824 lab

MIT6.824 lab1 MapReduce timeout: command not found -> brew install coreutils panic data race -> 加锁 内层变量会屏蔽外部同名变量 test1 word-count 测试基本功能 test2 indexer

GoodbyeYesterDay 0 Jan 5, 2022
TNO MPC Lab - Shamir Secret Sharing

TNO MPC Lab - Shamir Secret Sharing The TNO MPC lab consists of generic software components, procedures, and functionalities developed and maintained

TNO - MPC Lab 0 Nov 3, 2021
Distributed Lab 2: RPC in Go

Distributed Lab 2: RPC in Go Using the lab sheet There are two ways to use the lab sheet, you can either: create a new repo from this template - this

null 0 Oct 18, 2021
Concurrency Lab 2 Go Example

Concurrency Lab 2 If you're stuck look at examples on Go by Example Using the lab sheet There are two ways to use the lab sheet, you can either: creat

null 0 Oct 12, 2021
Concurrency Lab 1 Go Example

Concurrency Lab 1 If you're stuck look at examples on Go by Example Using the lab sheet There are two ways to use the lab sheet, you can either: creat

null 0 Oct 11, 2021
Concurrency Lab examples on Go

Concurrency Lab 1 If you're stuck look at examples on Go by Example Using the lab sheet There are two ways to use the lab sheet, you can either: creat

null 0 Oct 22, 2021
Distributed Lab 2: RPC in Go

Distributed Lab 2: RPC in Go Using the lab sheet There are two ways to use the lab sheet, you can either: create a new repo from this template - this

null 0 Oct 22, 2021
Distributed Lab 3: Message Broker in Go

Distributed Lab 3: Message Broker in Go Using the lab sheet There are two ways to use the lab sheet, you can either: create a new repo from this templ

null 0 Oct 29, 2021
A simple and sussy project is an implementation of SOMMIP Lab 1 written in Golang

SOMMIP Lab 1 Isac Arthur Table of Contents About The Project Getting Started Prerequisites Installation Supported commands About The Project This very

Arthur 1 Nov 10, 2021
A go tasks for students lab

Go tasks one first tasks for students lab Palindrome Given the string, check if it is a palindrome. Example For inputString = "aabaa", the output shou

Denis 0 Nov 20, 2021
Kong and Consul Lab For Golang

Kong and Consul Lab Prerequisites docker Deploy Consul Server docker run -d -p 8500:8500 -p 8600:8600/udp --name=consul-server consul agent -server -u

Ridwan Dwi Siswanto 1 Nov 25, 2021
Gophercon lab "Get Go-ing with GitHub Actions"

GitHub Action Using Go This is a starting point for a GitHub Action based in Go. This repo provides all the structure needed to build a robust GitHub

Doug Graiser 0 Dec 8, 2021
Explores GitHub Actions in Go Lab from GopherCon 2021

Gopher A Tweet An action that tweets. Gopher A Tweet was created based on GopherCon 2021s Gophers of Microsoft: GitHub Action in Go Lab to explore bui

Autumn Martin 0 Dec 10, 2021
mit 6.824 lab

lab-6.824 0. How to run? go版本: 1.13+ 在高于1.11的版本中报unexpected directory layout, 但是用较低版本goLand无法调试... unexpected dir layout 原因是不支持相对路径包引入, 遇到时在import 删掉.

JinyuChata 1 Dec 9, 2021
The kitchen part of the Restaurant simulation of the first lab at the Network Programming course

KitchenServerGo This is the kitchen part of the Restaurant simulation of the first lab at the Network Programming course. The dining hall part of the

null 0 Oct 13, 2021
learn mit 6.824 lab

MIT6.824 lab1 MapReduce timeout: command not found -> brew install coreutils panic data race -> 加锁 内层变量会屏蔽外部同名变量 test1 word-count 测试基本功能 test2 indexer

GoodbyeYesterDay 0 Jan 5, 2022
Os-signal-lab - Experiments with os signals and process trees

os-signal-lab Experiments with os signals and process trees There's a lot to rea

carl-fredrik grimberg 0 Feb 5, 2022