Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TLDR - 用最短的语言把事情说明白 #45

Open
jackalchenxu opened this issue Oct 14, 2024 · 1 comment
Open

TLDR - 用最短的语言把事情说明白 #45

jackalchenxu opened this issue Oct 14, 2024 · 1 comment

Comments

@jackalchenxu
Copy link
Owner

jackalchenxu commented Oct 14, 2024

Shamir's Secret Sharing(SSS)

  • 秘密 s
  • 构造这样的一个多项式: $f(x) = s + a_1x + a_2x^2 + a_3x^3 + ... + a_{n-1}x^{n-1}$
  • 阈值为n(只要有n份就可以恢复s,恢复的过程使用了拉格朗日插值法
  • 一个(x, f(x))则为一份信息,一共有m份信息,分配给m个用户, m>n
  • SSS的特点:
    • 少于n份信息,则无法恢复s
    • s的信息并不存在于m份信息中
@jackalchenxu
Copy link
Owner Author

jackalchenxu commented Oct 16, 2024

Lagrange interpolation / 拉格朗日插值法

针对xy平面上的n个点: $(x_1,y_1), (x_2, y_2), ... (x_n, y_n)$ , 我们可以使用该方法构造出一个n次多项式,即:
$y= a_0+a_1x + a_2x^2 + a_3x^3 + ... a_{n-1}x^{n-1}$
该多项式所代表的曲线,会经过以上n个点

如何来构建该多项式?
举例来说:当前有四个点,我们构造4条曲线:

  • L0只在x=0处为1,其他x=1,2,3时为0
  • L1只在x=1处为1, 其他x=0,2,3时为0
  • 以此类推
    1

然后我们把四条曲线各自乘以它们的y值,然后把四条曲线相加
2

最后的曲线就为目标曲线
3

数学式子为:
$\sum_{i=0}^{n}{y_il_i(x)}$
$l_i = (x-x_j)/(x_i-x_j), j\neq{i}$

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant