refactor block

This commit is contained in:
Neemek 2025-10-04 18:38:01 +02:00
parent 87a4a08f63
commit acc0b5e616

View file

@ -36,8 +36,7 @@ impl Block {
} }
} }
pub fn next(&mut self) { pub fn advance(&mut self) {
self.byte_index = 0;
self.counter += 1; self.counter += 1;
self.chunk = few_u32_to_many_u8(&chacha_block(&self.key, self.counter, self.nonce, self.rounds)); self.chunk = few_u32_to_many_u8(&chacha_block(&self.key, self.counter, self.nonce, self.rounds));
} }
@ -49,7 +48,8 @@ impl Block {
self.byte_index += 1; self.byte_index += 1;
if self.byte_index >= 64 { if self.byte_index >= 64 {
self.next() self.byte_index = 0;
self.advance();
} }
} }
} }