refactor block
This commit is contained in:
parent
87a4a08f63
commit
acc0b5e616
1 changed files with 3 additions and 3 deletions
|
|
@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue