Skip to content

Commit f710b57

Browse files
committed
Add description of shamir's secret sharing
1 parent 82e434d commit f710b57

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

doc/en/markdown/content/prikey_security.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,12 @@ Common splitting methods are 2-of-3, 3-of-5, etc. For example, in a 3-of-5 schem
122122

123123
Related reading: <https://en.wikipedia.org/wiki/Shamir%27s_secret_sharing>
124124

125+
Brief introduction to the algorithm principle:
126+
127+
0. k points on a plane can uniquely determine a curve of degree k-1. Treat the private key secret as a point at `(0, secret)`, then randomly generate `k - 1` random points to determine a curve on the plane.
128+
1. Randomly select n points on the curve that do not include `(0, secret)`, and save the coordinates of these points as fragments.
129+
2. When you need to recover the private key, simply substitute the coordinates of any k fragments into the Lagrange interpolation formula to recover the original polynomial, then substitute x=0 to obtain the private key secret. This is a simple k-of-n threshold scheme.
130+
125131
Advantages:
126132

127133
- The algorithm is open-source with widespread application and research support. Additionally, you don't need to depend on specific software or third-party libraries to implement the algorithm; any skilled programmer can implement the code based on the public algorithm.

doc/zh/markdown/content/prikey_security.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,12 @@ assert (a + b) % pabtc.secp256k1.N == c
123123

124124
相关阅读: <https://en.wikipedia.org/wiki/Shamir%27s_secret_sharing>
125125

126+
算法原理简要介绍:
127+
128+
0. 平面上 k 个点可以唯一确定一条 k-1 次的曲线. 将私钥 secret 作为视作 `(0, secret)` 处的一个点, 然后随机生成 `k - 1` 个随机点, 由此确定平面上的一条曲线.
129+
1. 在曲线上随机选择 n 个不包括 `(0, secret)` 的点, 将这些点的坐标作为分片进行保存.
130+
2. 当需要恢复私钥时, 只需要将任意 k 个分片的坐标代入拉格朗日插值公式, 就能恢复出原始的多项式, 然后将 x=0 带入, 从而得到私钥 secret. 这就是一个简单的 k-of-n 门限方案.
131+
126132
优点:
127133

128134
- 算法开源且有广泛的应用和研究支持. 同时您不需要依赖某个软件或者某个第三方库实现算法, 任何熟练的程序员都可以根据公开的算法实现代码.

0 commit comments

Comments
 (0)