Skip to content

Commit

Permalink
plonk: use std::count to check if the hasher buffer is of valid lengt…
Browse files Browse the repository at this point in the history
…h instead of explicitly checking all valid lengths.
  • Loading branch information
Vesselin Velichkov committed Aug 18, 2022
1 parent f80e3e6 commit ad41c3d
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions libsnark/zk_proof_systems/plonk/srs.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,7 @@ template<typename ppT> libff::Fr<ppT> transcript_hasher<ppT>::get_hash()
// If we are here, then the hasher buffer has invalid length so throw an
// exception
bool b_valid_length =
((buffer_len == length[0]) || (buffer_len == length[1]) ||
(buffer_len == length[2]) || (buffer_len == length[3]) ||
(buffer_len == length[4]) || (buffer_len == length[5]));
(0 != std::count(length.begin(), length.end(), buffer_len));
if (!b_valid_length) {
throw std::logic_error(
"Error: invalid length of transcript hasher buffer");
Expand Down

0 comments on commit ad41c3d

Please sign in to comment.