/// Create a new Pedersen commitment
///
/// Both polynomials must have at most num_coefficients coefficients.
/// The masking polynomial should be randomly generated with a secure
/// random number generator.
Create a new Pedersen commitment
Both polynomials must have at most num_coefficients coefficients.
The masking polynomial should be randomly generated with a secure
random number generator.
Create a new Pedersen commitment Both polynomials must have at most num_coefficients coefficients . The masking polynomial should be randomly generated with a secure random number generator .
pub fn create(
        p_values: &Polynomial,
        p_masking: &Polynomial,
        num_coefficients: usize,
    ) -> ThresholdEcdsaResult<Self> {
        if p_values.curve_type() != p_masking.curve_type() {
            return Err(ThresholdEcdsaError::CurveMismatch);
        }
        let curve = EccCurve::new(p_values.curve_type());
        let g = curve.generator_g()?;
        let h = curve.generator_h()?;
        let coeffs_values = p_values.get_coefficients(num_coefficients)?;
        let coeffs_masking = p_masking.get_coefficients(num_coefficients)?;
        let mut points = Vec::with_capacity(num_coefficients);
        for (coeff_values, coeff_masking) in coeffs_values.iter().zip(coeffs_masking) {
            // compute c = g*a + h*b
            let c = g.mul_points(coeff_values, &h, &coeff_masking)?;
            points.push(c);
        }
        Ok(Self::new(points))
    }
pub fn create ( p_values : & Polynomial , p_masking : & Polynomial , num_coefficients : usize , ) -> ThresholdEcdsaResult < Self > { if p_values . curve_type ( ) != p_masking . curve_type ( ) { return Err ( ThresholdEcdsaError :: CurveMismatch ) ; } let curve = EccCurve :: new ( p_values . curve_type ( ) ) ; let g = curve . generator_g ( ) ? ; let h = curve . generator_h ( ) ? ; let coeffs_values = p_values . get_coefficients ( num_coefficients ) ? ; let coeffs_masking = p_masking . get_coefficients ( num_coefficients ) ? ; let mut points = Vec :: with_capacity ( num_coefficients ) ; for ( coeff_values , coeff_masking ) in coeffs_values . iter ( ) . zip ( coeffs_masking ) { // compute c = g*a + h*b let c = g . mul_points ( coeff_values , & h , & coeff_masking ) ? ; points . push ( c ) ; } Ok ( Self :: new ( points ) ) }
Create a new Pedersen commitment
Both polynomials must have at most num_coefficients coefficients.
Create a new Pedersen commitment Both polynomials must have at most num_coefficients coefficients .
p_values
&Polynomial
p_masking
&Polynomial
num_coefficients
usize