Skip to content

Commit

Permalink
Merge c5336a6 into 5c4f19f
Browse files Browse the repository at this point in the history
  • Loading branch information
vezenovm authored Aug 30, 2024
2 parents 5c4f19f + c5336a6 commit f7720eb
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions noir_stdlib/src/hash/poseidon2.nr
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,13 @@ impl Poseidon2 {
}

fn perform_duplex(&mut self) {
// zero-pad the cache
for i in 0..RATE {
if i >= self.cache_size {
self.cache[i] = 0;
}
}
// add the cache into sponge state
for i in 0..RATE {
self.state[i] += self.cache[i];
// We effectively zero-pad the cache by only adding to the state
// cache that is less than the specified `cache_size`
if i < self.cache_size {
self.state[i] += self.cache[i];
}
}
self.state = crate::hash::poseidon2_permutation(self.state, 4);
}
Expand Down

0 comments on commit f7720eb

Please sign in to comment.