Skip to content

Commit 21e1d83

Browse files
authored
Remove padding from draw_random_bytes (#1148)
1 parent 6e017bb commit 21e1d83

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

crates/prover/src/core/channel/blake2s.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,9 @@ impl Channel for Blake2sChannel {
106106
fn draw_random_bytes(&mut self) -> Vec<u8> {
107107
let mut hash_input = self.digest.as_ref().to_vec();
108108

109-
// Pad the counter to 32 bytes.
110-
let mut padded_counter = [0; BLAKE_BYTES_PER_HASH];
109+
// Append counter bytes directly (4 bytes for u32).
111110
let counter_bytes = self.channel_time.n_sent.to_le_bytes();
112-
padded_counter[0..counter_bytes.len()].copy_from_slice(&counter_bytes);
113-
114-
hash_input.extend_from_slice(&padded_counter);
111+
hash_input.extend_from_slice(&counter_bytes);
115112

116113
self.channel_time.inc_sent();
117114
Blake2sHasher::hash(&hash_input).into()

crates/prover/src/core/channel/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub const EXTENSION_FELTS_PER_HASH: usize = 2;
1818
#[derive(Clone, Default, Debug)]
1919
pub struct ChannelTime {
2020
pub n_challenges: usize,
21-
n_sent: usize,
21+
n_sent: u32,
2222
}
2323

2424
impl ChannelTime {

0 commit comments

Comments
 (0)