Section 9 Shamir's secret sharing
Subsection 9.1 Basic setup
In 1979 Blakley and Shamir independently introduced the idea of secret sharing. A \((t, n)\) threshold secret sharing scheme is a method for \(n\) parties to distribute a secret such a way that at least \(t\) of them together can reconstruct it. Let us describe the steps of Shamir’s secret sharing scheme. Let \(\mathbb{F}_q\) be a finite field and the secret is \(s\in\mathbb{F}_q.\) We take \(t-1\) random field elements \(a_1,a_2,\ldots,a_{t-1}\) and we define the polynomial
That is we have that the secret is \(f(0).\) The shares \((i,f(i))\) are distributed to the \(n\) distinct parties. To reconstruct the secret we may use a classical algorithm called Lagrange interpolation.
Theorem 9.1. Lagrange interpolation.
Given \(t\) distinct points \((x_i, y_i)\) than there is a polynomial \(f(x)\) of degree less than \(t\) such that \(f(x_i)=y_i.\) The polynomial is as follows
Subsection 9.2 Example and SageMath implementation
Let us consider a concrete example. We work in the finite field \(\mathbb{F}_{37}\) and suppose that using the shares
one can reconstruct the secret. We obtain that
Therefore the secret is 8. We may also apply linear algebra to reconstruct the secret. Since \(t=6\) we need to consider a polynomial of the form
The shares yield the system of linear equations
It follows that
and the solution is given by \((8, 15, 19, 30, 5, 29).\) Thus the polynomial is \(f(x)=29x^5+5x^4+30x^3+19x^2+15x+8.\) The secret is the constant term, that is 8.
Now we provide a SageMath code to generate appropriate polynomials and shares and also a code to reconstruct the secret from given shares.
SageMath summary.
- cardinality()
Returns the number of elements of a set.
- lagrange_polynomial()
Returns the Lagrange polynomial corresponding to some points.
- union()
Returns the union of two sets.
Exercises 9.3 Exercises
1.
Use Shamir’s secret sharing to share \(s=19\) over \(\mathbb{F}_{79}\) such that 4 users can reconstruct the secret. Generate at least 6 shares.
2.
Shamir’s secret sharing with \(p= 31.\) We know the following shares and we also know that 3 parties can reconstruct the secret
Recover the secret by using the shares \(S_1,S_2,S_3\) and \(S_4,S_5,S_6.\)