Skip to content

Commit 3443722

Browse files
committed
chore: deduplicate array access
1 parent 609c696 commit 3443722

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/sha256.nr

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,15 @@ pub(crate) fn process_full_blocks<let N: u32>(
163163

164164
blocks[num_blocks] = new_msg_block;
165165
}
166+
166167
// verify the 0 padding is correct for the last block
168+
let final_block = blocks[first_partially_filled_block_index];
167169
verify_msg_block_zeros(
168-
blocks[first_partially_filled_block_index],
170+
final_block,
169171
message_size % BLOCK_SIZE,
170172
INT_BLOCK_SIZE,
171173
);
172-
(states[first_partially_filled_block_index], blocks[first_partially_filled_block_index])
174+
(states[first_partially_filled_block_index], final_block)
173175
}
174176

175177
// Take `BLOCK_SIZE` number of bytes from `msg` starting at `msg_start` and pack them into a `MSG_BLOCK`.

0 commit comments

Comments
 (0)