Struct ctr::Ctr

source ·
pub struct Ctr<B, F>where
    B: BlockEncrypt,
    F: CtrFlavor<B::BlockSize>,{ /* private fields */ }
Expand description

Generic CTR block mode isntance.

Implementations§

source§

impl<B, F> Ctr<B, F>where B: BlockEncrypt, F: CtrFlavor<B::BlockSize>,

source

pub fn seek_block(&mut self, block: F::Backend)

Seek to the given block

source

pub fn current_block(&self) -> F::Backend

Return number of the current block

Trait Implementations§

source§

impl<B, F> Clone for Ctr<B, F>where B: BlockEncrypt + Clone, F: CtrFlavor<B::BlockSize> + Clone, B::BlockSize: Clone,

source§

fn clone(&self) -> Ctr<B, F>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<B, F> Debug for Ctr<B, F>where B: BlockEncrypt + Debug, F: CtrFlavor<B::BlockSize> + Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl<B, F> FromBlockCipher for Ctr<B, F>where B: BlockEncrypt, F: CtrFlavor<B::BlockSize>,

§

type BlockCipher = B

Block cipher
§

type NonceSize = <B as BlockCipher>::BlockSize

Nonce size in bytes
source§

fn from_block_cipher(cipher: B, nonce: &Block<B>) -> Self

Instantiate a stream cipher from a block cipher
source§

impl<B, F> StreamCipher for Ctr<B, F>where B: BlockEncrypt, F: CtrFlavor<B::BlockSize>,

source§

fn try_apply_keystream(&mut self, data: &mut [u8]) -> Result<(), LoopError>

Apply keystream to the data, but return an error if end of a keystream will be reached. Read more
source§

fn apply_keystream(&mut self, data: &mut [u8])

Apply keystream to the data. Read more
source§

impl<B, F> StreamCipherSeek for Ctr<B, F>where B: BlockEncrypt, F: CtrFlavor<B::BlockSize>,

source§

fn try_current_pos<T: SeekNum>(&self) -> Result<T, OverflowError>

Try to get current keystream position Read more
source§

fn try_seek<S: SeekNum>(&mut self, pos: S) -> Result<(), LoopError>

Try to seek to the given position Read more
source§

fn current_pos<T>(&self) -> Twhere T: SeekNum,

Get current keystream position Read more
source§

fn seek<T>(&mut self, pos: T)where T: SeekNum,

Seek to the given position Read more

Auto Trait Implementations§

§

impl<B, F> RefUnwindSafe for Ctr<B, F>where B: RefUnwindSafe, F: RefUnwindSafe, <<B as BlockCipher>::BlockSize as ArrayLength<u8>>::ArrayType: RefUnwindSafe, <F as CtrFlavor<<B as BlockCipher>::BlockSize>>::Nonce: RefUnwindSafe,

§

impl<B, F> Send for Ctr<B, F>where B: Send, F: Send, <F as CtrFlavor<<B as BlockCipher>::BlockSize>>::Nonce: Send,

§

impl<B, F> Sync for Ctr<B, F>where B: Sync, F: Sync, <F as CtrFlavor<<B as BlockCipher>::BlockSize>>::Nonce: Sync,

§

impl<B, F> Unpin for Ctr<B, F>where B: Unpin, F: Unpin, <<B as BlockCipher>::BlockSize as ArrayLength<u8>>::ArrayType: Unpin, <F as CtrFlavor<<B as BlockCipher>::BlockSize>>::Nonce: Unpin,

§

impl<B, F> UnwindSafe for Ctr<B, F>where B: UnwindSafe, F: UnwindSafe, <<B as BlockCipher>::BlockSize as ArrayLength<u8>>::ArrayType: UnwindSafe, <F as CtrFlavor<<B as BlockCipher>::BlockSize>>::Nonce: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.