Lagrange interpolation theorem

Lagrangian interpolation is a function approximation method that constructs a polynomial function through known data points that passes exactly through those data points. It can be used for interpolation, which is to infer the value of an unknown function at other points from a given discrete data point. The advantage of the Lagrange interpolation method is that it is simple to calculate, easy to understand and implement, but because the higher the degree of polynomial, the greater the error will be, so it is suitable for fewer data points, and its definition is as follows

Lagrangian interpolation theorem is a commonly used algorithm in secret sharing, which can divide a secret into multiple parts and distribute them to multiple participants. Below we use a specific example to illustrate the operation process of Lagrange interpolation theorem.

Suppose there is a secret S, which needs to be divided into 4 parts and distributed to 4 participants respectively. We first randomly generate 4 different x values, and then use them as the interpolation points (x, y) in the Lagrange interpolation theorem:

x y
1 S1
2 S2
3 S3
4 S4

Among them, S1, S2, S3 and S4 represent the secret parts assigned to 4 participants respectively. Next, we compute the polynomial L(x) using the Lagrange interpolation theorem, and assign the secret part according to the coefficients of L(x). The calculation formula of Lagrange interpolation theorem is as follows:

L(x)=\sum_{i=0}^{k} y_{i} \prod_{j=0, j \neq i}^{k} \frac{x-x_{j}}{x_{i}-x_{j}}

In this formula, k represents the number of interpolation points, xi​ and yi​ represent the x and y values ​​of the i-th interpolation point, respectively.

Suppose we need to divide the secret into 4 parts, so the number of interpolation points is 4. According to the data in the above table, we can get:

L(x)=y_{0} \cdot \frac{\left(x-x_{1}\right)\left(x-x_{2}\right)\left(x-x_{3}\right)}{\left(x_{0}-x_{1}\right)\left(x_{0}-x_{2}\right)\left(x_{0}-x_{3}\right)}+y_{1} \cdot \frac{\left(x-x_{0}\right)\left(x-x_{2}\right)\left(x-x_{3}\right)}{\left(x_{1}-x_{0}\right)\left(x_{1}-x_{2}\right)\left(x_{1}-x_{3}\right)}+y_{2} \cdot \frac{\left(x-x_{0}\right)\left(x-x_{1}\right)\left(x-x_{3}\right)}{\left(x_{2}-x_{0}\right)\left(x_{2}-x_{1}\right)\left(x_{2}-x_{3}\right)}+y_{3} \cdot \frac{\left(x-x_{0}\right)\left(x-x_{1}\right)\left(x-x_{2}\right)}{\left(x_{3}-x_{0}\right)\left(x_{3}-x_{1}\right)\left(x_{3}-x_{2}\right)}

Among them, yi​ represents the corresponding secret part, and xi​ represents the x value of the i-th interpolation point. The coefficients of this polynomial are the secret parts assigned to each participant.

For example, suppose the value of the secret S is 10, and the 4 randomly generated x values ​​are 1, 2, 3 and 5, then the corresponding 4 y values ​​are:

x y
1 6
2 8
3 2
5 4

Substituting these values ​​into the formula of the Lagrangian interpolation theorem, the polynomial can be obtained:

L(x) = 6 \cdot \frac{(x-2)(x-3)(x-5)}{(1-2)(1-3)(1-5)} + 8 \cdot \frac{(x-1)(x-3)(x-5)}{(2-1)(2-3)(2-5)} + 2 \cdot \frac{(x-1)(x-2)(x-5)}{(3-1)(3-2)(3-5)} + 4 \cdot \frac{(x-1)(x-2)(x-3)}{(5-1)(5-2)(5-3)}

After simplification, we can get:

L(x) = -\frac{3}{40}x^3 + \frac{9}{20}x^2 - \frac{43}{40}x + 10

The coefficients of this polynomial are the secret parts assigned to each participant. For example, participant 1 can obtain the value of L(1), which can be substituted into the polynomial above to obtain:

L(1) = -\frac{3}{40}\cdot 1^3 + \frac{9}{20}\cdot 1^2 - \frac{43}{40}\cdot 1 + 10 = 6

Therefore, the secret part obtained by participant 1 is 6. In the same way, the secret portion assigned to other participants can be calculated. It should be noted that the Lagrange interpolation theorem can only guarantee that the polynomial is equal to the original function at the interpolation point, but not necessarily in other places. Therefore, if you want to obtain higher security, you need to use a more complex secret sharing algorithm.

Learning to navigate:https://www.xqnav.top/

Guess you like

Origin blog.csdn.net/qq_43874317/article/details/130769348