We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0ddc818 commit 32407a5Copy full SHA for 32407a5
src/poseidon2.nr
@@ -70,9 +70,13 @@ impl Poseidon2 {
70
}
71
72
// handle remaining elements after last full RATE-sized chunk
73
- let remainder_start = (in_len / RATE) * RATE;
74
- for j in remainder_start..in_len {
75
- state[j - remainder_start] += input[j];
+ let num_extra_fields = in_len % RATE;
+ if num_extra_fields != 0 {
+ let remainder_start = in_len - num_extra_fields;
76
+ state[0] += input[remainder_start];
77
+ if num_extra_fields > 1 {
78
+ state[1] += input[remainder_start + 1]
79
+ }
80
81
} else {
82
let mut states: [[Field; 4]; N / RATE + 1] = [[0; 4]; N / RATE + 1];
0 commit comments