Skip to content

Commit

Permalink
Simplify hash equality checks
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronFeickert committed Apr 2, 2024
1 parent 690c873 commit 51ea3aa
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions src/proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use curve25519_dalek::{
RistrettoPoint,
Scalar,
};
use itertools::izip;
use itertools::{izip, Itertools};
use merlin::Transcript;
use rand_core::CryptoRngCore;
#[cfg(feature = "serde")]
Expand Down Expand Up @@ -530,20 +530,12 @@ impl Proof {
};

// Each statement must use the same input set (checked using the hash for efficiency)
if !statements
.iter()
.map(|s| s.get_input_set().get_hash())
.all(|h| h == first_statement.get_input_set().get_hash())
{
if !statements.iter().map(|s| s.get_input_set().get_hash()).all_equal() {
return Err(ProofError::InvalidParameter);
}

// Each statement must use the same parameters (checked using the hash for efficiency)
if !statements
.iter()
.map(|s| s.get_params().get_hash())
.all(|h| h == first_statement.get_params().get_hash())
{
if !statements.iter().map(|s| s.get_params().get_hash()).all_equal() {
return Err(ProofError::InvalidParameter);
}

Expand Down

0 comments on commit 51ea3aa

Please sign in to comment.