fn commit<'a>(
        ck: &Self::CommitterKey,
        polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<G::ScalarField, P>>,
        rng: Option<&mut dyn RngCore>,
    ) -> Result<
        (
            Vec<LabeledCommitment<Self::Commitment>>,
            Vec<Self::Randomness>,
        ),
        Self::Error,
    >
    where
        P: 'a,
    {
        let rng = &mut crate::optional_rng::OptionalRng(rng);
        let mut comms = Vec::new();
        let mut rands = Vec::new();

        let commit_time = start_timer!(|| "Committing to polynomials");
        for labeled_polynomial in polynomials {
            Self::check_degrees_and_bounds(ck.supported_degree(), labeled_polynomial)?;

            let polynomial: &P = labeled_polynomial.polynomial();
            let label = labeled_polynomial.label();
            let hiding_bound = labeled_polynomial.hiding_bound();
            let degree_bound = labeled_polynomial.degree_bound();

            let commit_time = start_timer!(|| format!(
                "Polynomial {} of degree {}, degree bound {:?}, and hiding bound {:?}",
                label,
                polynomial.degree(),
                degree_bound,
                hiding_bound,
            ));

            let randomness = if let Some(h) = hiding_bound {
                Randomness::rand(h, degree_bound.is_some(), None, rng)
            } else {
                Randomness::empty()
            };

            let comm = Self::cm_commit(
                &ck.comm_key[..(polynomial.degree() + 1)],
                &polynomial.coeffs(),
                Some(ck.s),
                Some(randomness.rand),
            )
            .into();

            let shifted_comm = degree_bound.map(|d| {
                Self::cm_commit(
                    &ck.comm_key[(ck.supported_degree() - d)..],
                    &polynomial.coeffs(),
                    Some(ck.s),
                    randomness.shifted_rand,
                )
                .into()
            });

            let commitment = Commitment { comm, shifted_comm };
            let labeled_comm = LabeledCommitment::new(label.to_string(), commitment, degree_bound);

            comms.push(labeled_comm);
            rands.push(randomness);

            end_timer!(commit_time);
        }

        end_timer!(commit_time);
        Ok((comms, rands))
    }
/// Outputs a commitment to `polynomial`.
Outputs a commitment to `polynomial`.
Outputs a commitment to ` polynomial ` .
fn commit<'a>(
        ck: &Self::CommitterKey,
        polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<G::ScalarField, P>>,
        rng: Option<&mut dyn RngCore>,
    ) -> Result<
        (
            Vec<LabeledCommitment<Self::Commitment>>,
            Vec<Self::Randomness>,
        ),
        Self::Error,
    >
    where
        P: 'a,
    {
        let rng = &mut crate::optional_rng::OptionalRng(rng);
        let mut comms = Vec::new();
        let mut rands = Vec::new();
        let commit_time = start_timer!(|| "Committing to polynomials");
        for labeled_polynomial in polynomials {
            Self::check_degrees_and_bounds(ck.supported_degree(), labeled_polynomial)?;
            let polynomial: &P = labeled_polynomial.polynomial();
            let label = labeled_polynomial.label();
            let hiding_bound = labeled_polynomial.hiding_bound();
            let degree_bound = labeled_polynomial.degree_bound();
            let commit_time = start_timer!(|| format!(
                "Polynomial {} of degree {}, degree bound {:?}, and hiding bound {:?}",
                label,
                polynomial.degree(),
                degree_bound,
                hiding_bound,
            ));
            let randomness = if let Some(h) = hiding_bound {
                Randomness::rand(h, degree_bound.is_some(), None, rng)
            } else {
                Randomness::empty()
            };
            let comm = Self::cm_commit(
                &ck.comm_key[..(polynomial.degree() + 1)],
                &polynomial.coeffs(),
                Some(ck.s),
                Some(randomness.rand),
            )
            .into();
            let shifted_comm = degree_bound.map(|d| {
                Self::cm_commit(
                    &ck.comm_key[(ck.supported_degree() - d)..],
                    &polynomial.coeffs(),
                    Some(ck.s),
                    randomness.shifted_rand,
                )
                .into()
            });
            let commitment = Commitment { comm, shifted_comm };
            let labeled_comm = LabeledCommitment::new(label.to_string(), commitment, degree_bound);
            comms.push(labeled_comm);
            rands.push(randomness);
            end_timer!(commit_time);
        }
        end_timer!(commit_time);
        Ok((comms, rands))
    }
fn commit < ' a > ( ck : & Self :: CommitterKey , polynomials : impl IntoIterator < Item = & ' a LabeledPolynomial < G :: ScalarField , P > > , rng : Option < & mut dyn RngCore > , ) -> Result < ( Vec < LabeledCommitment < Self :: Commitment > > , Vec < Self :: Randomness > , ) , Self :: Error , > where P : ' a , { let rng = & mut crate :: optional_rng :: OptionalRng ( rng ) ; let mut comms = Vec :: new ( ) ; let mut rands = Vec :: new ( ) ; let commit_time = start_timer ! ( " " ) ; for labeled_polynomial in polynomials { Self :: check_degrees_and_bounds ( ck . supported_degree ( ) , labeled_polynomial ) ? ; let polynomial : & P = labeled_polynomial . polynomial ( ) ; let label = labeled_polynomial . label ( ) ; let hiding_bound = labeled_polynomial . hiding_bound ( ) ; let degree_bound = labeled_polynomial . degree_bound ( ) ; let commit_time = start_timer ! ( format ( " " label polynomial degree ( ) degree_bound hiding_bound ) ) ; let randomness = if let Some ( h ) = hiding_bound { Randomness :: rand ( h , degree_bound . is_some ( ) , None , rng ) } else { Randomness :: empty ( ) } ; let comm = Self :: cm_commit ( & ck . comm_key [ .. ( polynomial . degree ( ) + 1 ) ] , & polynomial . coeffs ( ) , Some ( ck . s ) , Some ( randomness . rand ) , ) . into ( ) ; let shifted_comm = degree_bound . map ( | d | { Self :: cm_commit ( & ck . comm_key [ ( ck . supported_degree ( ) - d ) .. ] , & polynomial . coeffs ( ) , Some ( ck . s ) , randomness . shifted_rand , ) . into ( ) } ) ; let commitment = Commitment { comm , shifted_comm } ; let labeled_comm = LabeledCommitment :: new ( label . to_string ( ) , commitment , degree_bound ) ; comms . push ( labeled_comm ) ; rands . push ( randomness ) ; end_timer ! ( commit_time ) ; } end_timer ! ( commit_time ) ; Ok ( ( comms , rands ) ) }
Outputs a commitment to `polynomial`.
Outputs a commitment to ` polynomial ` .
ck
&Self::CommitterKey
polynomials
impl IntoIterator<Item = &'a LabeledPolynomial<G::ScalarField, P>>
rng
Option<&mut dyn RngCore>