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

Method is_valid

schnorr_pok/src/partial.rs:149–167  ·  view source on GitHub ↗

Keys of `missing_responses` are the witness indices whose response was generated while creating this. Instead, these come from some other Schnorr protocol.

(
        &self,
        bases: &[G],
        y: &G,
        t: &G,
        challenge: &G::ScalarField,
        missing_responses: BTreeMap<usize, G::ScalarField>,
    )

Source from the content-addressed store, hash-verified

147 /// Keys of `missing_responses` are the witness indices whose response was generated while creating this. Instead,
148 /// these come from some other Schnorr protocol.
149 pub fn is_valid(
150 &self,
151 bases: &[G],
152 y: &G,
153 t: &G,
154 challenge: &G::ScalarField,
155 missing_responses: BTreeMap<usize, G::ScalarField>,
156 ) -> Result<(), SchnorrError> {
157 let full_resp = self.pre_verify(bases, missing_responses)?;
158 if (G::Group::msm_unchecked(bases, &full_resp)
159 .add(y.mul_bigint((-*challenge).into_bigint())))
160 .into_affine()
161 == *t
162 {
163 Ok(())
164 } else {
165 Err(SchnorrError::InvalidResponse)
166 }
167 }
168
169 /// Same as `Self::is_valid` except it uses `RandomizedMultChecker` to combine the scalar multiplication checks into a single
170 pub fn verify_using_randomized_mult_checker(

Callers 1

discrete_log_partialFunction · 0.45

Calls 2

pre_verifyMethod · 0.45
addMethod · 0.45

Tested by 1

discrete_log_partialFunction · 0.36