【隐私计算】 秘密共享方案
【隐私计算】 秘密共享方案
Shamir 秘密共享方案
Shamir’s Secret Sharing Scheme is based on Lagrange Interception.
Now suppose there are $n$ people, and $t$ is the threshold for secret recovery
Construct a polynimal at first, the form like:
$$ P(x) = a_{t-1}x^{t-1} + a_{t-2}x^{t-2} + \cdots + a_2x^2 + a_1x + a_0 $$
Setting $a_0$ as the secret. Each person is allocated a secret share represented as $(i, a_{i}x^{i})$.
For the secret recovery, we need to construct a Lagrange Interception to compute the coefficients $a_0$(secret). The Lagrange Interpolation method is as follows
$$L(x) = \sum_{j=0}^{n} y_j \prod_{\substack{i=0 \ i \neq j}}^{n} \frac{x - x_i}{x_j - x_i}$$
In the above formula, by setting $x = 0$, the value of $a_0$ can be calculated.
Python code for implementing the Shamir Secret Sharing Scheme:
1 | # Shamir |
Reference: https://www.geeksforgeeks.org/implementing-shamirs-secret-sharing-scheme-in-python/
基于中国剩余定理的秘密共享方案
CRT(Chinese Remainder Theory) can be used to solve the Secret Sharing. My seudocode is as follow:
python code:
1 | # 基于中国剩余定理的秘密共享方案 |
Brickell Secret Sharing
The Brickell Secret Sharing Scheme is based on multi-dimensional vectors, allowing for the specification of designated groups for secret recovery.
Steps:
Sharing Generation:
- Assuming the secret = $S$, $n$ = 4, the vector dimension is $d$ = 3.
- Define the reconstruct rules ${(v1,v2,v3),(v1,v5)}$, means that person(1~3) and person(1 and 5) can recover the secret.
- Generate v1 to v5, ensuring that any group of vectors can linearly construct $(1,0,0)$
- Generate d-1 random numbers ${a_1,a_2…,a_{d-1}}$. In here, generate $a_1 = S, a_2 = 55$, $a_3 = 28$
- Compute the sharing, $S_i = a * v_i$, and the sharing is $(S_i, i)$
Secret Reconstruction
- Collect the sharing, ensuring that the sharing groups follow the rules ${(v1,v2,v3),(v1,v5)}$, assuming the $S_1 = 55, S_2 = 10, S_3 = 17$
- use the sharing group to linearly construct $(1,0,0)$, $c_1v_1+c_2v_2+c_3v_3 = (1,0,0)$, get the coefficients $c_1=-1, c_2=1, c_3=1$
- Recover the $S$, $S = c_1S_1+c_2S_2+c_3S_3$
总结
Secret sharing schemes are widely used in privacy computing. Here is a summary of their advantages and disadvantages.
Advantages
- It allows for the addition of new shareholders without changing the existing shareholders’ secret shares, demonstrating excellent scalability.
- Based on the original shared secret key, the secret shares can be invalidated by altering other terms without changing the constant term.
Disadvantages
- It relies on the credibility of the secret distributor. If the distributor is dishonest and distributes a fake share to a participant, it can cause confusion during the sharing process.
- Some participants may submit invalid secret shares, preventing the correct secret from being recovered. A secure point-to-point channel needs to be established between the secret distributor and the participants.