Shamir's original paper (PDF, 197kb) describing a threshold secret sharing scheme states:
To make this claim more precise, we use modular arithmetic instead of real arithmetic. The set of integers modulo a prime number $p$ forms a field in which interpolation is possible. Given an integer valued data $D$, we pick a prime $p$ which is bigger than both $D$ and $n$. The coefficients $a_1,...,a_{k-1}~$ in $q(x)$ are randomly chosen from a uniform distribution over the integers in [0, $p$), and the values $D_1,...,D_n$ are computed modulo $p$.
Where:
- $D$ is the secret to be shared
- $n$ is the number of shares
- $k$ is the threshold number of shares needed to reconstruct $D$
- $q(x)$ is a $k-1$ order polynomial with $q(0)=D$ and the coefficients $a_1,...,a_{k-1}~$
- $D_1,...,D_n$ are individual shares (points on the polynomial $q(x)$)
Can someone please explain (in the simplest possible manner) the reason that Shamir's Secret Sharing Scheme uses finite field arithmetic? Also, why must the size of the Galois field be a prime number with the requirements that Shamir put forth?
The reason for asking these questions is: I would like to implement Shamir Sharing in Javascript using a field of size $2^8 = 256$, which:
- will obviate the need for a big integer library for Javascript, such as jsbn
- will simplify the math.
Whatever the size of the secret to be shared, it could be broken down into byte-length segments and the math performed on those segments. The resulting share would be a concatenation of the results of the necessary operations on each segment.
To find the secret, the shares can again be broken down into byte-length segments. The polynomial interpolation can be done with the corresponding byte-length segments from the shares to get individual segments of the secret. The segments can then be concatenated to form the complete secret.
Would this work and be cryptographically secure?
If there is indeed an absolute necessity for a prime number $p$, could I use any small prime number with the concatenations described to perform the necessary operations in Javascript and still remain cryptographically secure?