Skip to content

Commit 953b2b6

Browse files
feat: remove zero padding check (#44)
Co-authored-by: Tom French <[email protected]>
1 parent e247187 commit 953b2b6

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

src/sha256.nr

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,7 @@ pub(crate) fn process_full_blocks<let N: u32>(
154154
blocks[num_blocks] = new_msg_block;
155155
}
156156

157-
// verify the 0 padding is correct for the last block
158-
let final_block = blocks[first_partially_filled_block_index];
159-
verify_msg_block_zeros(final_block, message_size % BLOCK_SIZE, INT_BLOCK_SIZE);
160-
(states[first_partially_filled_block_index], final_block)
157+
(states[first_partially_filled_block_index], blocks[first_partially_filled_block_index])
161158
}
162159

163160
// Take `BLOCK_SIZE` number of bytes from `msg` starting at `msg_start` and pack them into a `MSG_BLOCK`.
@@ -214,13 +211,6 @@ fn build_msg_block<let N: u32>(msg: [u8; N], message_size: u32, msg_start: u32)
214211

215212
if !is_unconstrained() {
216213
let mut msg_end = msg_start + BLOCK_SIZE;
217-
if msg_end > N {
218-
msg_end = N;
219-
}
220-
// We might have to go beyond the input to pad the fields.
221-
if msg_end % INT_SIZE != 0 {
222-
msg_end = msg_end + INT_SIZE - msg_end % INT_SIZE;
223-
}
224214

225215
let max_read_index = std::cmp::min(message_size, msg_end);
226216

0 commit comments

Comments
 (0)