Struct cipher::stream_wrapper::StreamCipherCoreWrapper
source · pub struct StreamCipherCoreWrapper<T: BlockSizeUser>{
core: T,
buffer: Block<T>,
pos: u8,
}
Expand description
Wrapper around StreamCipherCore
implementations.
It handles data buffering and implements the slice-based traits.
Fields§
§core: T
§buffer: Block<T>
§pos: u8
Implementations§
source§impl<T: StreamCipherCore> StreamCipherCoreWrapper<T>
impl<T: StreamCipherCore> StreamCipherCoreWrapper<T>
fn set_pos_unchecked(&mut self, pos: usize)
fn check_remaining(&self, dlen: usize) -> Result<(), StreamCipherError>
Trait Implementations§
source§impl<T: Clone + BlockSizeUser> Clone for StreamCipherCoreWrapper<T>
impl<T: Clone + BlockSizeUser> Clone for StreamCipherCoreWrapper<T>
source§fn clone(&self) -> StreamCipherCoreWrapper<T>
fn clone(&self) -> StreamCipherCoreWrapper<T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<T: Default + BlockSizeUser> Default for StreamCipherCoreWrapper<T>
impl<T: Default + BlockSizeUser> Default for StreamCipherCoreWrapper<T>
source§fn default() -> StreamCipherCoreWrapper<T>
fn default() -> StreamCipherCoreWrapper<T>
Returns the “default value” for a type. Read more
source§impl<T: IvSizeUser + BlockSizeUser> IvSizeUser for StreamCipherCoreWrapper<T>
impl<T: IvSizeUser + BlockSizeUser> IvSizeUser for StreamCipherCoreWrapper<T>
source§impl<T: KeyInit + BlockSizeUser> KeyInit for StreamCipherCoreWrapper<T>
impl<T: KeyInit + BlockSizeUser> KeyInit for StreamCipherCoreWrapper<T>
source§fn new_from_slice(key: &[u8]) -> Result<Self, InvalidLength>
fn new_from_slice(key: &[u8]) -> Result<Self, InvalidLength>
Create new value from variable size key.
source§fn generate_key(
rng: impl CryptoRng + RngCore,
) -> GenericArray<u8, Self::KeySize>
fn generate_key( rng: impl CryptoRng + RngCore, ) -> GenericArray<u8, Self::KeySize>
Generate random key using the provided
CryptoRng
.source§impl<T: KeyIvInit + BlockSizeUser> KeyIvInit for StreamCipherCoreWrapper<T>
impl<T: KeyIvInit + BlockSizeUser> KeyIvInit for StreamCipherCoreWrapper<T>
source§fn new(key: &Key<Self>, iv: &Iv<Self>) -> Self
fn new(key: &Key<Self>, iv: &Iv<Self>) -> Self
Create new value from fixed length key and nonce.
source§fn new_from_slices(key: &[u8], iv: &[u8]) -> Result<Self, InvalidLength>
fn new_from_slices(key: &[u8], iv: &[u8]) -> Result<Self, InvalidLength>
Create new value from variable length key and nonce.
source§fn generate_key(
rng: impl CryptoRng + RngCore,
) -> GenericArray<u8, Self::KeySize>
fn generate_key( rng: impl CryptoRng + RngCore, ) -> GenericArray<u8, Self::KeySize>
Generate random key using the provided
CryptoRng
.source§fn generate_iv(rng: impl CryptoRng + RngCore) -> GenericArray<u8, Self::IvSize>
fn generate_iv(rng: impl CryptoRng + RngCore) -> GenericArray<u8, Self::IvSize>
Generate random IV using the provided
CryptoRng
.source§fn generate_key_iv(
rng: impl CryptoRng + RngCore,
) -> (GenericArray<u8, Self::KeySize>, GenericArray<u8, Self::IvSize>)
fn generate_key_iv( rng: impl CryptoRng + RngCore, ) -> (GenericArray<u8, Self::KeySize>, GenericArray<u8, Self::IvSize>)
Generate random key and nonce using the provided
CryptoRng
.source§impl<T: KeySizeUser + BlockSizeUser> KeySizeUser for StreamCipherCoreWrapper<T>
impl<T: KeySizeUser + BlockSizeUser> KeySizeUser for StreamCipherCoreWrapper<T>
source§impl<T: StreamCipherCore> StreamCipher for StreamCipherCoreWrapper<T>
impl<T: StreamCipherCore> StreamCipher for StreamCipherCoreWrapper<T>
source§fn try_apply_keystream_inout(
&mut self,
data: InOutBuf<'_, '_, u8>,
) -> Result<(), StreamCipherError>
fn try_apply_keystream_inout( &mut self, data: InOutBuf<'_, '_, u8>, ) -> Result<(), StreamCipherError>
Apply keystream to
inout
data. Read moresource§fn try_apply_keystream(
&mut self,
buf: &mut [u8],
) -> Result<(), StreamCipherError>
fn try_apply_keystream( &mut self, buf: &mut [u8], ) -> Result<(), StreamCipherError>
Apply keystream to data behind
buf
. Read moresource§fn apply_keystream_inout(&mut self, buf: InOutBuf<'_, '_, u8>)
fn apply_keystream_inout(&mut self, buf: InOutBuf<'_, '_, u8>)
Apply keystream to
inout
data. Read moresource§fn apply_keystream(&mut self, buf: &mut [u8])
fn apply_keystream(&mut self, buf: &mut [u8])
Apply keystream to data in-place. Read more
source§fn apply_keystream_b2b(
&mut self,
input: &[u8],
output: &mut [u8],
) -> Result<(), StreamCipherError>
fn apply_keystream_b2b( &mut self, input: &[u8], output: &mut [u8], ) -> Result<(), StreamCipherError>
Apply keystream to data buffer-to-buffer. Read more
source§impl<T: StreamCipherSeekCore> StreamCipherSeek for StreamCipherCoreWrapper<T>
impl<T: StreamCipherSeekCore> StreamCipherSeek for StreamCipherCoreWrapper<T>
source§fn try_current_pos<SN: SeekNum>(&self) -> Result<SN, OverflowError>
fn try_current_pos<SN: SeekNum>(&self) -> Result<SN, OverflowError>
Try to get current keystream position Read more
source§fn try_seek<SN: SeekNum>(
&mut self,
new_pos: SN,
) -> Result<(), StreamCipherError>
fn try_seek<SN: SeekNum>( &mut self, new_pos: SN, ) -> Result<(), StreamCipherError>
Try to seek to the given position Read more
source§fn current_pos<T: SeekNum>(&self) -> T
fn current_pos<T: SeekNum>(&self) -> T
Get current keystream position Read more
Auto Trait Implementations§
impl<T> Freeze for StreamCipherCoreWrapper<T>
impl<T> RefUnwindSafe for StreamCipherCoreWrapper<T>where
T: RefUnwindSafe,
<<T as BlockSizeUser>::BlockSize as ArrayLength<u8>>::ArrayType: RefUnwindSafe,
impl<T> Send for StreamCipherCoreWrapper<T>where
T: Send,
impl<T> Sync for StreamCipherCoreWrapper<T>where
T: Sync,
impl<T> Unpin for StreamCipherCoreWrapper<T>
impl<T> UnwindSafe for StreamCipherCoreWrapper<T>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)