MCPcopy Create free account
hub / github.com/docknetwork/crypto / add_many

Method add_many

utils/src/randomized_mult_checker.rs:79–90  ·  view source on GitHub ↗

Add a check of the form ` = t`. Expects `a` and `b` to be of the same length

(
        &mut self,
        a: impl IntoIterator<Item = G>,
        b: impl IntoIterator<Item = &'a G::ScalarField>,
        t: G,
    )

Source from the content-addressed store, hash-verified

77
78 /// Add a check of the form `<a, b> = t`. Expects `a` and `b` to be of the same length
79 pub fn add_many<'a>(
80 &mut self,
81 a: impl IntoIterator<Item = G>,
82 b: impl IntoIterator<Item = &'a G::ScalarField>,
83 t: G,
84 ) {
85 for (a_i, b_i) in a.into_iter().zip(b) {
86 self.add(a_i, self.current_random * b_i);
87 }
88 self.add(t, -self.current_random);
89 self.current_random *= self.random;
90 }
91
92 /// Combine all the checks into a multi-scalar multiplication and return true if the result is 0.
93 pub fn verify(&self) -> bool {

Callers 3

basicFunction · 0.80

Calls 2

into_iterMethod · 0.45
addMethod · 0.45

Tested by 1

basicFunction · 0.64