1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
use cipher::{
generic_array::{ArrayLength, GenericArray},
SeekNum,
};
mod ctr128;
mod ctr32;
mod ctr64;
pub use ctr128::*;
pub use ctr32::*;
pub use ctr64::*;
pub trait CtrFlavor<B>
where
Self: Default + Clone,
B: ArrayLength<u8>,
{
type Nonce: Clone;
type Backend: SeekNum;
fn generate_block(&self, nonce: &Self::Nonce) -> GenericArray<u8, B>;
fn load(block: &GenericArray<u8, B>) -> Self::Nonce;
fn checked_add(&self, rhs: usize) -> Option<Self>;
fn increment(&mut self);
fn from_backend(v: Self::Backend) -> Self;
fn to_backend(&self) -> Self::Backend;
}