Skip to content

Commit d0b3c5c

Browse files
committed
fix
1 parent f0e29d6 commit d0b3c5c

File tree

1 file changed

+5
-0
lines changed
  • plonky2x/core/src/frontend/hash/blake2

1 file changed

+5
-0
lines changed

plonky2x/core/src/frontend/hash/blake2/curta.rs

+5
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,11 @@ impl<L: PlonkParameters<D>, const D: usize> CircuitBuilder<L, D> {
194194
input: &[ByteVariable],
195195
length: U32Variable,
196196
) -> Bytes32Variable {
197+
// Check that length <= input.len(). This is needed to ensure that users cannot
198+
// prove the hash of a longer message than they supplied.
199+
let supplied_input_length = self.constant::<U32Variable>(input.len() as u32);
200+
self.lte(length, supplied_input_length);
201+
197202
let last_chunk = self.compute_blake2b_last_chunk_index(length);
198203
if self.blake2b_accelerator.is_none() {
199204
self.blake2b_accelerator = Some(BLAKE2BAccelerator {

0 commit comments

Comments
 (0)