Skip to content

Commit

Permalink
fmt and fixing loose ends
Browse files Browse the repository at this point in the history
  • Loading branch information
nstilt1 committed Jan 17, 2024
1 parent 9d3d870 commit 303714a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
10 changes: 4 additions & 6 deletions chacha20/src/rng.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,9 @@ macro_rules! impl_chacha_rng {
pub type $ChaChaXCore = ChaChaCore<$rounds, Ietf>;

impl $ChaChaXCore {
/// Sets the block pos. This does not affect the RNG's index, so if it has
/// Sets the block pos. This does not affect the RNG's index, so if it has
/// already changed, it will not reset it.
///
///
/// This can be used with either:
/// * u32
/// * [u8; 4]
Expand Down Expand Up @@ -360,10 +360,8 @@ macro_rules! impl_chacha_rng {
if self.index >= BUFFER_SIZE {
self.generate_and_set(0);
}
let (consumed_u32, filled_u8) = fill_via_u32_chunks(
&self.buffer[self.index..],
&mut dest[read_len..],
);
let (consumed_u32, filled_u8) =
fill_via_u32_chunks(&self.buffer[self.index..], &mut dest[read_len..]);

self.index += consumed_u32;
read_len += filled_u8;
Expand Down
12 changes: 6 additions & 6 deletions chacha20/src/xchacha.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
use cipher::{
array::Array,
consts::{U16, U24, U32, U64},
BlockSizeUser, IvSizeUser, KeyIvInit, KeySizeUser, StreamCipherCoreWrapper, StreamClosure,
BlockSizeUser, IvSizeUser, KeyIvInit, KeySizeUser, StreamCipherCore, StreamCipherCoreWrapper,
StreamCipherSeekCore, StreamClosure,
};

use crate::{variants::Ietf, ChaChaCore, Rounds, CONSTANTS, R12, R20, R8, STATE_WORDS};

#[cfg(feature = "zeroize")]
use zeroize::ZeroizeOnDrop;

Expand Down Expand Up @@ -190,11 +193,8 @@ mod hchacha20_tests {
"82413b4227b27bfed30e42508a877d73"
"a0f9e4d58a74a853c12ec41326d3ecdc"
);

let actual = hchacha::<R20>(
Array::from_slice(&KEY),
Array::from_slice(&INPUT),
);

let actual = hchacha::<R20>(Array::from_slice(&KEY), Array::from_slice(&INPUT));
assert_eq!(actual.as_slice(), &OUTPUT);
}
}

0 comments on commit 303714a

Please sign in to comment.