Skip to content

Commit a5a2fb5

Browse files
committed
Fixed get_random_bytes now always being hashed
1 parent 0c9ed21 commit a5a2fb5

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

src/prime_gen.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use crate::{
88
fn hash_int<F: Field>(hasher: &mut KeccakTranscript) -> F::U {
99
let n_bytes = F::W::num_words() * 8;
1010
let bytes = hasher.get_random_bytes(n_bytes);
11-
hasher.absorb(&bytes);
1211
F::U::from_bytes_be(&bytes).expect("Failed to convert bytes to CryptoUint")
1312
}
1413

src/transcript.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ impl KeccakTranscript {
5151
}
5252

5353
result.truncate(length);
54+
55+
self.hasher.update([0x12]);
56+
self.hasher.update(&result);
57+
self.hasher.update([0x34]);
58+
5459
result
5560
}
5661

@@ -145,9 +150,6 @@ impl KeccakTranscript {
145150
for i in 0..I::W::num_words() {
146151
let mut challenge = [0u8; 8];
147152
challenge.copy_from_slice(self.get_random_bytes(8).as_slice());
148-
self.hasher.update([0x12]);
149-
self.hasher.update(challenge);
150-
self.hasher.update([0x34]);
151153
words[i] = PrimitiveConversion::from_primitive(u64::from_le_bytes(challenge));
152154
}
153155

0 commit comments

Comments
 (0)