Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
duyuefeng0708
GitHub Repository: duyuefeng0708/Cryptography-From-First-Principle
Path: blob/main/frontier/12-mpc/README.md
483 views
unlisted

Module 12: Multi-Party Computation

View on nbviewer

Multiple parties compute a joint function without revealing their private inputs.

Prerequisites

Learning Objectives

After completing this module you will:

  1. Implement Shamir and additive secret sharing and understand their threshold properties

  2. Understand Yao's garbled circuits for secure two party computation

  3. Grasp oblivious transfer and its role as an MPC building block

  4. See how the SPDZ protocol achieves malicious security using MACs and preprocessing

Explore (SageMath Notebooks)

Work through these notebooks in order:

#NotebookWhat You'll Learn
aSecret Sharing: ShamirSplitting a secret into polynomial shares with a (t, n) threshold
bSecret Sharing: AdditiveThe simplest sharing scheme, random splits that sum to the secret
cYao's Garbled CircuitsEncrypting a Boolean circuit so one party evaluates without learning inputs
dOblivious TransferA sender offers two messages; the receiver learns exactly one, sender learns nothing
eSPDZ ProtocolPreprocessing Beaver triples and MAC based verification for malicious security

Implement (Rust)

Build these from scratch in rust/src/lib.rs:

#FunctionDescription
1shamir_shareSplit a secret into n shares using a random degree (t-1) polynomial
2shamir_reconstructReconstruct the secret from t or more shares via Lagrange interpolation
3additive_shareSplit a secret into n additive shares over a finite field
4additive_reconstructReconstruct the secret by summing all additive shares
5beaver_triple_mulPerform a secret shared multiplication using a preprocessed Beaver triple

Run: cargo test -p mpc

Break

Try these attacks in the break/ folder:

  • Cheating dealer detection in Shamir sharing. Detect when a dealer distributes inconsistent shares by using verification polynomials.

  • Corrupt party in additive sharing. Observe how a single malicious party can bias the output and why MACs are needed.

Connect

See where this shows up in practice (in the connect/ folder):

  • Threshold wallets in cryptocurrency. Split a signing key across multiple devices or custodians so no single point of compromise exists.

  • Private set intersection. Two parties discover shared contacts without revealing their full lists (used in contact tracing and ad measurement).

  • Secure auctions. Compute the winning bid without revealing any losing bids to the auctioneer.


This is the final module in the series.