Trait ctr::flavors::CtrFlavor

source ·
pub trait CtrFlavor<B>where
    Self: Default + Clone,
    B: ArrayLength<u8>,{
    type Nonce: Clone;
    type Backend: SeekNum;

    // Required methods
    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;
}
Expand description

Trait implemented by different counter types used in the CTR mode.

Required Associated Types§

source

type Nonce: Clone

Inner representation of nonce.

source

type Backend: SeekNum

Backend numeric type

Required Methods§

source

fn generate_block(&self, nonce: &Self::Nonce) -> GenericArray<u8, B>

Generate block for given nonce value.

source

fn load(block: &GenericArray<u8, B>) -> Self::Nonce

Load nonce value from bytes.

source

fn checked_add(&self, rhs: usize) -> Option<Self>

Checked addition.

source

fn increment(&mut self)

Wrapped increment.

source

fn from_backend(v: Self::Backend) -> Self

Convert from a backend value

source

fn to_backend(&self) -> Self::Backend

Convert to a backend value

Implementors§

source§

impl<B> CtrFlavor<B> for Ctr32BEwhere Self: Default + Clone, B: ArrayLength<u8> + PartialDiv<U4>, PartialQuot<B, U4>: ArrayLength<u32>,

source§

impl<B> CtrFlavor<B> for Ctr32LEwhere Self: Default + Clone, B: ArrayLength<u8> + PartialDiv<U4>, PartialQuot<B, U4>: ArrayLength<u32>,

source§

impl<B> CtrFlavor<B> for Ctr64BEwhere Self: Default + Clone, B: ArrayLength<u8> + PartialDiv<U8>, PartialQuot<B, U8>: ArrayLength<u64>,

source§

impl<B> CtrFlavor<B> for Ctr64LEwhere Self: Default + Clone, B: ArrayLength<u8> + PartialDiv<U8>, PartialQuot<B, U8>: ArrayLength<u64>,

source§

impl<B> CtrFlavor<B> for Ctr128BEwhere Self: Default + Clone, B: ArrayLength<u8> + PartialDiv<U16>, PartialQuot<B, U16>: ArrayLength<u128>,

source§

impl<B> CtrFlavor<B> for Ctr128LEwhere Self: Default + Clone, B: ArrayLength<u8> + PartialDiv<U16>, PartialQuot<B, U16>: ArrayLength<u128>,