RightSignal
1 of 4

Your RightSignal

Concept of the day1 / 3

Shamir's secret sharing

The concept

How five people can each hold part of a key that any three can unlock

Shamir's secret sharing splits a secret into n shares. Any k of them rebuild it, but fewer than k reveal nothing. For example, five managers each hold a share of a vault password, and any three can open the vault.

The trick is a curve. Turn the secret into a number s, and make it the height where a curve crosses x = 0. With k = 2 the curve is a straight line with a random slope. Each person gets one point on that line, such as (1, 8) or (2, 11).

What it’s forBuilds the hidden curve whose points become the shares.

f(x) = s + a₁x + … + aₖ₋₁xᵏ⁻¹ (mod p)

s
the secret, which is the curve's value at x = 0
aᵢ
random numbers picked once and then thrown away
k
the threshold, how many shares are needed, e.g. 3
p
a large prime; all the maths wraps around at p

What it givesShares (1, f(1)), (2, f(2)), … to hand out. Any k of them pin down f, and f(0) is the secret.

  1. k = 2, s = 5, a₁ = 3: f(x) = 5 + 3x
  2. Shares: f(1) = 8, f(2) = 11, f(3) = 14
  3. From (1, 8) and (2, 11): slope = 11 − 8 = 3, so s = 8 − 3 = 5