LFDT-Lockness / generic-ec

Generic elliptic curve cryptography in Rust
Apache License 2.0
2 stars 2 forks source link

`generic_ec_zkp::polynomial::lagrange_coefficient` should accept nullable scalars as well #26

Closed maurges closed 6 months ago

maurges commented 7 months ago

Sometimes we want to do interpolations for values with zero being known, like in our new (secret) protocol. I suggest a new signature, directly copied from there:

fn lagrange_coefficient<E: Curve, S: AsRef<Scalar<E>>>(
    x: Scalar<E>,
    j: usize,
    xs: &[S],
) -> Option<Scalar<E>> {
survived commented 7 months ago

Yea, that makes sense. Originally, I designed it to accept non-zeroes only because it was supposed to be used only in secret sharings (well, in simpler versions of secret sharing than what you're working on). Now it's clear that it should accept any scalars.