Path: blob/main/frontier/12-mpc/sage/12b-secret-sharing-additive.ipynb
483 views
Notebook 12b: Additive Secret Sharing
Module 12: Multi-Party Computation
Motivating Question. Shamir's scheme is powerful but complex, it uses polynomial interpolation and works with thresholds. Is there a simpler secret sharing scheme? Additive secret sharing is the simplest possible: split a secret into random pieces that sum to it. The trade-off: all parties must participate to reconstruct.
Prerequisites. You should be comfortable with:
Shamir secret sharing and its threshold property (Notebook 12a)
Modular arithmetic (Module 01)
Learning objectives. By the end of this notebook you will be able to:
Split a secret into additive shares.
Implement XOR-based sharing for binary data.
Perform addition and scalar multiplication on shared values.
Understand why multiplication requires communication.
Compare additive and Shamir sharing.
1. Additive Sharing: The Simplest Scheme
Bridge from Notebook 12a. Shamir uses degree- polynomials to achieve thresholds. Additive sharing is the special case : all parties must collaborate. The upside: it's trivially simple and very efficient.
The idea:
Secret
Pick uniformly at random
Set
Reconstruct:
This is an scheme, you need all shares to recover the secret.
Checkpoint 1. Additive sharing is an scheme: all shares are needed. Each individual share looks uniformly random, knowing shares gives zero information about the secret. The simplicity comes at a cost: no threshold flexibility.
2. XOR-Based Sharing (Binary)
For binary data (bits, byte strings), we can use XOR instead of addition mod . XOR is just addition in .
3. Operations on Additive Shares
Like Shamir, additive shares support local addition: each party adds their shares independently.
If and , then .
Checkpoint 2. Additive sharing supports free (no-communication) addition and scalar multiplication. Adding a public constant requires only one party to act. These are the same properties as Shamir, but simpler.
4. The Multiplication Problem
Multiplication is where things get hard. If parties hold and , can they compute locally?
Party 1 can compute but not (they don't know ). Multiplication requires communication between parties.
5. Beaver Triples: Multiplication Without Revealing Inputs
A Beaver triple is a pre-computed triple of random values where , shared among all parties. Using a triple, parties can compute from and with minimal communication:
Open and (these are random, so they reveal nothing)
Each party computes:
Why?
Misconception alert. "Opening and leaks the inputs." No! Since and are uniformly random and unknown, and are also uniformly random, they carry no information about or .
6. Shamir vs Additive: Comparison
Crypto foreshadowing. The SPDZ protocol (Notebook 12e) uses additive secret sharing as its foundation. Beaver triples are generated in an offline preprocessing phase, then consumed during online computation. This separation makes the online phase extremely fast.
7. Exercises
Exercise 1 (Worked): Inner Product
Problem. Compute the inner product on additively shared vectors, using two Beaver triples.
Solution:
Exercise 2 (Guided): Comparison Protocol
Problem. Two parties each have a value. They want to know if their values are equal without revealing them. Use additive sharing: share both values, compute the difference, and check if it's zero.
Fill in the TODOs:
Exercise 3 (Independent): Multi-Party Sum
Problem.
Five parties each have a private salary. Use additive sharing so they can compute the average salary without anyone learning individual values.
Implement this: each party creates shares of their value and distributes one share to each other party. Then all parties sum their received shares and broadcast the result.
Why doesn't this reveal individual salaries even though the average is public?
Summary
| Concept | Key Fact |
|---|---|
| Additive sharing | ; all shares needed |
| XOR sharing | Same idea for binary: |
| Addition | Local: each party adds their shares (no communication) |
| Multiplication | Needs Beaver triples: open random masks, compute locally |
| Beaver triple | Pre-shared with ; one per multiplication |
| vs Shamir | Simpler but no threshold flexibility (all-or-nothing) |
Additive sharing trades threshold flexibility for simplicity. Combined with Beaver triples for multiplication, it forms the foundation of efficient MPC protocols like SPDZ.