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

Secret sharing library in Go

This library implements Shamir secret sharing over finite fields and secret sharing over the integers for integers. In addition, facilities are offered to perform computations on shares of secrets.

Shamir secret sharing

For an explanation of Shamir secret sharing over finite fields, refer to Wikipedia.

Suppose you'd like to share a secret 123 over the finite field of integers modulo 7919. You want to have 5 shares of which 4 are needed for reconstruction of the secret. In this case, you choose a sharing degree of 3.

shares := ShareFiniteField(big.NewInt(123), big.NewInt(7919), 3, 5)

You can then reconstruct the secret by saying

secret, err := SecretShareCombine(shares[0:4])
// secret is a big.Int containing 123

Addition of secret shares

If you have two secrets 123 and 456, and you would like to share these and compute the sum 123+456 as a group, you would send share n of 123 and share n of 456 to friend n for 0 < n < 5, and keep shares 0 to yourself. Then each friend (and you) do

sumShareN, err := ShareAdd([]SecretShare{firstShareN, secondShareN})

Then, you may SecretShareCombine the sumShares to recover 579.

Multiplication of secret shares

In the same way, you can compute the product 123*456 by sharing them both and having all of your friends call ShareMul. Note that if your secrets are shared with degree t, you will need at least 2t+1 shares to recover the shared product (k*t+1 shares for a product of k factors). For a group of five friends and two factors, this limits the degree to t = 2.

Secret sharing over the integers

If you share secrets over a finite field, your computations might wrap around. If you do not want this, you can secret share over the integers instead. Note that while Shamir secret sharing is information theoretically secure, sharing over the integers is not, and provides instead a configurable sigma bits of statistical security.

To share 123 over the integers, with 100 bits of statistical security, write

shares := ShareIntegers(big.NewInt(123), big.NewInt(10000), 100, 3, 5)

Here, 10000 is the upper bound on the secret you are sharing.

Owner
TNO - MPC Lab
TNO - MPC Lab
TNO - MPC Lab
Similar Resources

Demonstration of sharing secret data between an OAuth/OIDC client and an Identity Providers web client.

OAuth / OIDC Cubbyhole Share secret data between client applications. This is mostly a demonstration of some of the work I've been evaluating at Storj

Mar 21, 2022

False-sharing-demo - Demo for performance effects of CPU cache false-sharing

Example of CPU cache false-sharing in Go. A simple example where 2 integer varia

Aug 28, 2022

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

Oct 18, 2021

Concurrency Lab 1 Go Example

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

Oct 11, 2021

Concurrency Lab 2 Go Example

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

Oct 12, 2021

Concurrency Lab examples on Go

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

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

Oct 22, 2021

Distributed Lab 3: Message Broker in Go

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

Oct 29, 2021

A simple and sussy project is an implementation of SOMMIP Lab 1 written in Golang

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

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

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

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

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

Dec 10, 2021

mit 6.824 lab

mit 6.824 lab

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

Dec 9, 2021

The kitchen part of the Restaurant simulation of the first lab at the Network Programming course

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

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

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

Feb 5, 2022

Secret - Encrypt anything with a password

 Secret - Encrypt anything with a password

Secret - Encrypt anything with a password Ever wanted to hide a file? Now you can do it really easily! Usage secret {-e/--encrypt | -d/--decrypt} sou

Aug 10, 2022

Teller - the open-source universal secret manager for developers

 Teller - the open-source universal secret manager for developers

A secrets management tool for developers built in Go - never leave your command line for secrets.

Jan 8, 2023
Concurrency Lab 1 Go Example
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

Oct 11, 2021
Concurrency Lab 2 Go Example
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

Oct 12, 2021
A simple and sussy project is an implementation of SOMMIP Lab 1 written in Golang
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

Nov 10, 2021
mit 6.824 lab
mit 6.824 lab

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

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

Jan 5, 2022
Lima launches Linux virtual machines on macOS, with automatic file sharing, port forwarding, and containerd.

Lima: Linux-on-Mac ("macOS subsystem for Linux", "containerd for Mac")

Jan 8, 2023
Let's Go is task sharing app implemented in golang.

Let's Go - A sample GO app Overview Let's Go is an HTTP server. It has various apis to play with. It is a small app that can group users of a company

Dec 13, 2021
Simple Shamir's Secret Sharing (s4) - A go package giving a easy to use interface for the shamir's secret sharing algorithm

Simple Shamir's Secret Sharing (s4) With Simple Shamir's Secret Sharing (s4) I want to provide you an easy to use interface for this beautiful little

Jan 2, 2023
TNO MPC Lab - Paillier

TNO MPC Lab - Paillier The TNO MPC lab consists of generic software components, procedures, and functionalities developed and maintained on a regular

Nov 3, 2021
CLI for Shamir's Secret Sharing and AES key generation, encryption, and decryption.
CLI for Shamir's Secret Sharing and AES key generation, encryption, and decryption.

Shush ?? This simple program will help you run Shamir's Secret Sharing algorithm on any file using the split and merge commands.

Feb 1, 2022