Let M\mathcal{M} be some data domain, indexed from 00 to ∣M∣−1|\mathcal{M}| - 1, and assume n,t∈N+n, t \in \mathbb{N}^+ such that t≤nt \le n.

Problem. Distribute a secret m∈Mm \in \mathcal{M} among nn parties P1,…,PnP_1, \ldots, P_n such that any subset of at least tt parties, termed an authorized subset, can reconstruct mm, whereas any subset with fewer than tt parties cannot.

Shamir's Idea: Use polynomials!

Encoding

Encoding Algorithm (Share mm):

  1. Choose a prime number pp, s.t., p≥max⁡{n,∣M∣}p \ge \max \{n, |\mathcal{M}| \}.
  2. Generate independent uniform random integers a1,…,at−1∈Fpa_1, \ldots, a_{t - 1} \in \mathbb{F}_p, and let a0=ma_0 = m.
  3. Construct Polynomial f(x)=at−1xt−1+at−2xt−2+⋯+mf(x) = a_{t - 1} x^{t - 1} + a_{t - 2} x^{t - 2} + \cdots + m, s.t.,f(0)=a0=m. f(0) = a_0 = m.
  4. Compute si=f(i),∀i∈[n]s_i = f(i), \forall i \in [n]. Output (s1,…,sn)(s_1, \ldots, s_n), i.e., distribute sis_i to party PiP_i.

Security

It is easy to see that any subset of size <t< t can not reconstruct a0=ma_0 = m.

Theorem. Given m,c1,…,ct−1∈Fpm, c_1, \ldots, c_{t - 1} \in \mathbb{F}_p, it holds that

Pr⁡[s1=c1,st−1=ct−1]=1pt−1. \Pr \left[ s_1 = c_1, s_{t - 1} = c_{t - 1} \right] = \frac{1}{p^{t - 1}}.

By symmetry, it is easy to see this theorem applies to arbitrary size-(t−1)(t - 1) subset of (s1,…,sn)(s_1, \ldots, s_n).

Proof. The unknown vector (at−1,…,a1)(a_{t - 1}, \ldots, a_1) satisfies the following linear system:

[11⋯ ,12t−12t−2⋯ ,1⋮(t−1)t−1(t−1)t−2⋯ ,1][at−1at−2⋮a0]=[s1s2⋮st−1], \begin{bmatrix} 1& 1& \cdots, 1 \\ 2^{t - 1}& 2^{t - 2}& \cdots, 1 \\ & \vdots \\ (t - 1)^{t - 1}& (t - 1)^{t - 2}& \cdots, 1 \end{bmatrix} \begin{bmatrix} a_{t - 1} \\ a_{t - 2} \\ \vdots \\ a_0 \end{bmatrix} = \begin{bmatrix} s_1 \\ s_2 \\ \vdots \\ s_{t - 1} \end{bmatrix},

i.e.,

[11⋯ ,12t−12t−2⋯ ,2⋮(t−1)t−1(t−1)t−2⋯ ,(t−1)][at−1at−2⋮a1]=[s1−a0s2−a0⋮st−1−a0]. \begin{bmatrix} 1& 1& \cdots, 1 \\ 2^{t - 1}& 2^{t - 2}& \cdots, 2 \\ & \vdots \\ (t - 1)^{t - 1}& (t - 1)^{t - 2}& \cdots, (t - 1) \end{bmatrix} \begin{bmatrix} a_{t - 1} \\ a_{t - 2} \\ \vdots \\ a_1 \end{bmatrix} = \begin{bmatrix} s_1 - a_0\\ s_2 - a_0\\ \vdots \\ s_{t - 1} - a_0 \end{bmatrix}.

which can be solved efficiently as the first matrix is a Vandermonde one.

□\square

Decoding

As for reconstruction, assume without loss of generality, the input is s1,…,sts_1, \ldots, s_t.

Reconstruct ( s1,…,sts_1, \ldots, s_t ):
The unknown vector (at−1,…,a0)(a_{t - 1}, \ldots, a_0) can be reconstructed from the following linear system:

[11⋯ ,12t−12t−2⋯ ,1⋮tt−1tt−2⋯ ,1][at−1at−2⋮a0]=[s1s2⋮st]. \begin{bmatrix} 1& 1& \cdots, 1 \\ 2^{t - 1}& 2^{t - 2}& \cdots, 1 \\ & \vdots \\ t^{t - 1}& t^{t - 2}& \cdots, 1 \end{bmatrix} \begin{bmatrix} a_{t - 1} \\ a_{t - 2} \\ \vdots \\ a_0 \end{bmatrix} = \begin{bmatrix} s_1 \\ s_2 \\ \vdots \\ s_t \end{bmatrix}.

Note. Fast reconstruction is possible, as the first matrix is a Vandermonde matrix.

After knowing at−1,…,a0a_{t - 1}, \ldots, a_0, we can recover all s1,…,sns_1, \ldots, s_n.

Remark. The encoding and decoding scheme is akin to Reed-Solomon Codes.

Remark. It is possible to corrupt fewer than p−t+12\frac{p - t + 1}{2} of (s1,…,sn)(s_1, \ldots, s_n) and still be able to decode.

Reference

[1] Note by Yael Kalai “Secret Sharing Schemes”.