Skip to main content

LinearCombination

Trait LinearCombination 

Source
pub trait LinearCombination<PointsAndScalars>: CurveGroup
where PointsAndScalars: AsRef<[(Self, Self::Scalar)]> + ?Sized,
{ // Provided methods fn lincomb(points_and_scalars: &PointsAndScalars) -> Self { ... } fn lincomb_vartime(points_and_scalars: &PointsAndScalars) -> Self { ... } }
Expand description

Linear combination.

This trait enables optimized implementations of linear combinations (e.g. Shamir’s Trick).

It’s generic around PointsAndScalars to allow overlapping impls. For example, const generic impls can use the input size to determine the size needed to store temporary variables.

Provided Methods§

Source

fn lincomb(points_and_scalars: &PointsAndScalars) -> Self

Calculates x1 * k1 + ... + xn * kn.

Source

fn lincomb_vartime(points_and_scalars: &PointsAndScalars) -> Self

Calculates x1 * k1 + ... + xn * kn.

This is equivalent to LinearCombination::lincomb except that it may leak the value of the points and/or scalars due to variable-time behavior.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§