pub trait CtrFlavor<B: ArrayLength<u8>> {
type CtrNonce: Clone;
type Backend: Counter;
const NAME: &'static str;
// Required methods
fn remaining(cn: &Self::CtrNonce) -> Option<usize>;
fn next_block(cn: &mut Self::CtrNonce) -> GenericArray<u8, B>;
fn current_block(cn: &Self::CtrNonce) -> GenericArray<u8, B>;
fn from_nonce(block: &GenericArray<u8, B>) -> Self::CtrNonce;
fn set_from_backend(cn: &mut Self::CtrNonce, v: Self::Backend);
fn as_backend(cn: &Self::CtrNonce) -> Self::Backend;
}
Expand description
Trait implemented by different CTR flavors.
Required Associated Types§
Required Associated Constants§
Required Methods§
sourcefn remaining(cn: &Self::CtrNonce) -> Option<usize>
fn remaining(cn: &Self::CtrNonce) -> Option<usize>
Return number of remaining blocks.
If result does not fit into usize
, returns None
.
sourcefn next_block(cn: &mut Self::CtrNonce) -> GenericArray<u8, B>
fn next_block(cn: &mut Self::CtrNonce) -> GenericArray<u8, B>
Generate block for given nonce
and current counter value.
sourcefn current_block(cn: &Self::CtrNonce) -> GenericArray<u8, B>
fn current_block(cn: &Self::CtrNonce) -> GenericArray<u8, B>
Generate block for given nonce
and current counter value.
sourcefn from_nonce(block: &GenericArray<u8, B>) -> Self::CtrNonce
fn from_nonce(block: &GenericArray<u8, B>) -> Self::CtrNonce
Initialize from bytes.
sourcefn set_from_backend(cn: &mut Self::CtrNonce, v: Self::Backend)
fn set_from_backend(cn: &mut Self::CtrNonce, v: Self::Backend)
Convert from a backend value
sourcefn as_backend(cn: &Self::CtrNonce) -> Self::Backend
fn as_backend(cn: &Self::CtrNonce) -> Self::Backend
Convert to a backend value
Object Safety§
This trait is not object safe.