Function lagrange_interpolation_zero

Source
pub fn lagrange_interpolation_zero(
    points: &[(BigUint, BigUint)],
    modulus: &BigUint,
) -> Option<BigUint>
Expand description

Performs Lagrange interpolation at zero for a given set of points modulo a given modulus.

This function calculates the Lagrange polynomial that passes through a given set of points and evaluates it at zero. This is particularly useful in secret sharing schemes, such as Shamir’s Secret Sharing, where the secret is reconstructed from shares without revealing the shares themselves.

§Parameters

  • points: A slice of tuples where each tuple contains two BigUint values. The first element of each tuple represents the x-coordinate, and the second element represents the y-coordinate of a point on the polynomial.
  • modulus: A reference to a BigUint value representing the modulus for the finite field operations.

§Returns

Returns Some(BigUint) representing the secret (the polynomial evaluated at zero) if the inverse of the denominator exists for all terms in the interpolation formula. Otherwise, returns None.