sha2 -- introduce locals to clarify which subportions are being borrowed
This commit is contained in:
parent
8dff89c238
commit
b0ac40a243
@ -453,7 +453,8 @@ impl Engine256 {
|
||||
assert!(!self.finished)
|
||||
// Assumes that input.len() can be converted to u64 without overflow
|
||||
self.length_bits = add_bytes_to_bits(self.length_bits, input.len() as u64);
|
||||
self.buffer.input(input, |input: &[u8]| { self.state.process_block(input) });
|
||||
let self_state = &mut self.state;
|
||||
self.buffer.input(input, |input: &[u8]| { self_state.process_block(input) });
|
||||
}
|
||||
|
||||
fn finish(&mut self) {
|
||||
@ -461,10 +462,11 @@ impl Engine256 {
|
||||
return;
|
||||
}
|
||||
|
||||
self.buffer.standard_padding(8, |input: &[u8]| { self.state.process_block(input) });
|
||||
let self_state = &mut self.state;
|
||||
self.buffer.standard_padding(8, |input: &[u8]| { self_state.process_block(input) });
|
||||
write_u32_be(self.buffer.next(4), (self.length_bits >> 32) as u32 );
|
||||
write_u32_be(self.buffer.next(4), self.length_bits as u32);
|
||||
self.state.process_block(self.buffer.full_buffer());
|
||||
self_state.process_block(self.buffer.full_buffer());
|
||||
|
||||
self.finished = true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user