Skip to content

Commit 072c1ac

Browse files
committed
Minor rust borrows changes.
1 parent 82757d5 commit 072c1ac

File tree

5 files changed

+3
-835
lines changed

5 files changed

+3
-835
lines changed

src/toolbox/sigma/schnorr_proof.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,9 @@ where
4545
fn prover_commit(
4646
&self,
4747
witness: &Self::Witness,
48-
rng: &mut (impl Rng + CryptoRng),
48+
mut rng: &mut (impl Rng + CryptoRng),
4949
) -> (Self::Commitment, Self::ProverState) {
50-
let mut nonces: Vec<G::Scalar> = Vec::new();
51-
for _i in 0..self.morphismp.morphism.num_scalars {
52-
nonces.push(<G as Group>::Scalar::random(&mut *rng));
53-
}
50+
let nonces: Vec<G::Scalar> = (0..self.morphismp.morphism.num_scalars).map(move |_| G::Scalar::random(&mut rng)).collect();
5451
let prover_state = (nonces.clone(), witness.clone());
5552
let commitment = self.morphismp.morphism.evaluate(&nonces);
5653
(commitment, prover_state)
@@ -85,7 +82,7 @@ where
8582
.take(self.morphismp.morphism.num_statements())
8683
{
8784
rhs.push(
88-
*g + self.morphismp.morphism.group_elements[self.morphismp.image[i]] * *challenge,
85+
self.morphismp.morphism.group_elements[self.morphismp.image[i]] * challenge + g,
8986
);
9087
}
9188

tests/dleq_using_constraint_api.rs

Lines changed: 0 additions & 172 deletions
This file was deleted.

0 commit comments

Comments
 (0)