1pub use cipher::{
2 IvSizeUser, KeyIvInit, KeySizeUser, StreamCipherCoreWrapper,
3 array::Array,
4 consts::{U12, U32, U64},
5};
6
7use crate::{ChaChaCore, R8, R12, R20, Rounds, variants::Ietf};
8
9pub type Key = Array<u8, U32>;
11
12pub type Nonce = Array<u8, U12>;
14
15pub type ChaCha8 = StreamCipherCoreWrapper<ChaChaCore<R8, Ietf>>;
17
18pub type ChaCha12 = StreamCipherCoreWrapper<ChaChaCore<R12, Ietf>>;
20
21pub type ChaCha20 = StreamCipherCoreWrapper<ChaChaCore<R20, Ietf>>;
23
24pub(crate) type Block = Array<u8, U64>;
25
26impl<R: Rounds> KeySizeUser for ChaChaCore<R, Ietf> {
27 type KeySize = U32;
28}
29
30impl<R: Rounds> IvSizeUser for ChaChaCore<R, Ietf> {
31 type IvSize = U12;
32}
33impl<R: Rounds> KeyIvInit for ChaChaCore<R, Ietf> {
34 #[inline]
35 fn new(key: &Key, iv: &Nonce) -> Self {
36 ChaChaCore::<R, Ietf>::new_internal(key.as_ref(), iv.as_ref())
37 }
38}