digest::core_api

Struct CoreWrapper

Source
pub struct CoreWrapper<T>{ /* private fields */ }
Expand description

Wrapper around BufferKindUser.

It handles data buffering and implements the slice-based traits.

Implementations§

Source§

impl<T> CoreWrapper<T>

Source

pub fn from_core(core: T) -> Self

Create new wrapper from core.

Source

pub fn decompose(self) -> (T, Buffer<T>)

Decompose wrapper into inner parts.

Trait Implementations§

Source§

impl<T> BlockSizeUser for CoreWrapper<T>

Source§

type BlockSize = <T as BlockSizeUser>::BlockSize

Size of the block in bytes.
Source§

fn block_size() -> usize

Return block size in bytes.
Source§

impl<T> Clone for CoreWrapper<T>

Source§

fn clone(&self) -> CoreWrapper<T>

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<T> CoreProxy for CoreWrapper<T>

Source§

type Core = T

Type wrapped by CoreWrapper.
Source§

impl<T> Debug for CoreWrapper<T>

Source§

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

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

impl<T> Default for CoreWrapper<T>

Source§

fn default() -> CoreWrapper<T>

Returns the “default value” for a type. Read more
Source§

impl<T> ExtendableOutput for CoreWrapper<T>

Source§

type Reader = XofReaderCoreWrapper<<T as ExtendableOutputCore>::ReaderCore>

Reader
Source§

fn finalize_xof(self) -> Self::Reader

Retrieve XOF reader and consume hasher instance.
Source§

fn finalize_xof_into(self, out: &mut [u8])

Finalize XOF and write result into out.
Source§

fn digest_xof(input: impl AsRef<[u8]>, output: &mut [u8])
where Self: Default,

Compute hash of data and write it into output.
Source§

fn finalize_boxed(self, output_size: usize) -> Box<[u8]>

Retrieve result into a boxed slice of the specified size and consume the hasher. Read more
Source§

impl<T> ExtendableOutputReset for CoreWrapper<T>

Source§

fn finalize_xof_reset(&mut self) -> Self::Reader

Retrieve XOF reader and reset hasher instance state.
Source§

fn finalize_xof_reset_into(&mut self, out: &mut [u8])

Finalize XOF, write result into out, and reset the hasher state.
Source§

fn finalize_boxed_reset(&mut self, output_size: usize) -> Box<[u8]>

Retrieve result into a boxed slice of the specified size and reset the hasher state. Read more
Source§

impl<T> FixedOutput for CoreWrapper<T>

Source§

fn finalize_into(self, out: &mut Output<Self>)

Consume value and write result into provided array.
Source§

fn finalize_fixed(self) -> Output<Self>

Retrieve result and consume the hasher instance.
Source§

impl<T> FixedOutputReset for CoreWrapper<T>

Source§

fn finalize_into_reset(&mut self, out: &mut Output<Self>)

Write result into provided array and reset the hasher state.
Source§

fn finalize_fixed_reset(&mut self) -> Output<Self>

Retrieve result and reset the hasher state.
Source§

impl<T> KeyInit for CoreWrapper<T>

Source§

fn new(key: &Key<Self>) -> Self

Create new value from fixed size key.
Source§

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>

Generate random key using the provided CryptoRng.
Source§

impl<T> KeySizeUser for CoreWrapper<T>

Source§

type KeySize = <T as KeySizeUser>::KeySize

Key size in bytes.
Source§

fn key_size() -> usize

Return key size in bytes.
Source§

impl<T> OutputSizeUser for CoreWrapper<T>

Source§

type OutputSize = <T as OutputSizeUser>::OutputSize

Size of the output in bytes.
Source§

fn output_size() -> usize

Return output size in bytes.
Source§

impl<T> Reset for CoreWrapper<T>

Source§

fn reset(&mut self)

Reset state to its initial value.
Source§

impl<T> Update for CoreWrapper<T>

Source§

fn update(&mut self, input: &[u8])

Update state using the provided data.
Source§

fn chain(self, data: impl AsRef<[u8]>) -> Self
where Self: Sized,

Digest input data in a chained manner.
Source§

impl<T> Write for CoreWrapper<T>

Source§

fn write(&mut self, buf: &[u8]) -> Result<usize>

Writes a buffer into this writer, returning how many bytes were written. Read more
Source§

fn flush(&mut self) -> Result<()>

Flushes this output stream, ensuring that all intermediately buffered contents reach their destination. Read more
1.36.0 · Source§

fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> Result<usize, Error>

Like write, except that it writes from a slice of buffers. Read more
Source§

fn is_write_vectored(&self) -> bool

🔬This is a nightly-only experimental API. (can_vector)
Determines if this Writer has an efficient write_vectored implementation. Read more
1.0.0 · Source§

fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>

Attempts to write an entire buffer into this writer. Read more
Source§

fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>

🔬This is a nightly-only experimental API. (write_all_vectored)
Attempts to write multiple buffers into this writer. Read more
1.0.0 · Source§

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

Writes a formatted string into this writer, returning any error encountered. Read more
1.0.0 · Source§

fn by_ref(&mut self) -> &mut Self
where Self: Sized,

Creates a “by reference” adapter for this instance of Write. Read more
Source§

impl<T> HashMarker for CoreWrapper<T>

Source§

impl<T> MacMarker for CoreWrapper<T>

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<D> Digest for D

Source§

fn new() -> D

Create new hasher instance.
Source§

fn new_with_prefix(data: impl AsRef<[u8]>) -> D
where D: Default,

Create new hasher instance which has processed the provided data.
Source§

fn update(&mut self, data: impl AsRef<[u8]>)

Process data, updating the internal state.
Source§

fn chain_update(self, data: impl AsRef<[u8]>) -> D

Process input data in a chained manner.
Source§

fn finalize(self) -> GenericArray<u8, <D as OutputSizeUser>::OutputSize>

Retrieve result and consume hasher instance.
Source§

fn finalize_into( self, out: &mut GenericArray<u8, <D as OutputSizeUser>::OutputSize>, )

Write result into provided array and consume the hasher instance.
Source§

fn finalize_reset( &mut self, ) -> GenericArray<u8, <D as OutputSizeUser>::OutputSize>

Retrieve result and reset hasher instance.
Source§

fn finalize_into_reset( &mut self, out: &mut GenericArray<u8, <D as OutputSizeUser>::OutputSize>, )

Write result into provided array and reset the hasher instance.
Source§

fn reset(&mut self)
where D: Reset,

Reset hasher instance to its initial state.
Source§

fn output_size() -> usize

Get output size of the hasher
Source§

fn digest( data: impl AsRef<[u8]>, ) -> GenericArray<u8, <D as OutputSizeUser>::OutputSize>

Compute hash of data.
Source§

impl<D> DynDigest for D
where D: Update + FixedOutputReset + Reset + Clone + 'static,

Source§

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

Digest input data. Read more
Source§

fn finalize_reset(&mut self) -> Box<[u8]>

Retrieve result and reset hasher instance
Source§

fn finalize(self: Box<D>) -> Box<[u8]>

Retrieve result and consume boxed hasher instance
Source§

fn finalize_into(self, buf: &mut [u8]) -> Result<(), InvalidBufferSize>

Write result into provided array and consume the hasher instance. Read more
Source§

fn finalize_into_reset( &mut self, buf: &mut [u8], ) -> Result<(), InvalidBufferSize>

Write result into provided array and reset the hasher instance. Read more
Source§

fn reset(&mut self)

Reset hasher instance to its initial state.
Source§

fn output_size(&self) -> usize

Get output size of the hasher
Source§

fn box_clone(&self) -> Box<dyn DynDigest>

Clone hasher state into a boxed trait object
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where 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> Mac for T

Source§

fn new(key: &GenericArray<u8, <T as KeySizeUser>::KeySize>) -> T
where T: KeyInit,

Create new value from fixed size key.
Source§

fn new_from_slice(key: &[u8]) -> Result<T, InvalidLength>
where T: KeyInit,

Create new value from variable size key.
Source§

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

Update state using the provided data.
Source§

fn chain_update(self, data: impl AsRef<[u8]>) -> T

Process input data in a chained manner.
Source§

fn finalize(self) -> CtOutput<T>

Obtain the result of a Mac computation as a CtOutput and consume Mac instance.
Source§

fn finalize_reset(&mut self) -> CtOutput<T>

Obtain the result of a Mac computation as a CtOutput and reset Mac instance.
Source§

fn reset(&mut self)
where T: Reset,

Reset MAC instance to its initial state.
Source§

fn verify( self, tag: &GenericArray<u8, <T as OutputSizeUser>::OutputSize>, ) -> Result<(), MacError>

Check if tag/code value is correct for the processed input.
Source§

fn verify_reset( &mut self, tag: &GenericArray<u8, <T as OutputSizeUser>::OutputSize>, ) -> Result<(), MacError>

Check if tag/code value is correct for the processed input and reset Mac instance.
Source§

fn verify_slice(self, tag: &[u8]) -> Result<(), MacError>

Check truncated tag correctness using all bytes of calculated tag. Read more
Source§

fn verify_slice_reset(&mut self, tag: &[u8]) -> Result<(), MacError>

Check truncated tag correctness using all bytes of calculated tag and reset Mac instance. Read more
Source§

fn verify_truncated_left(self, tag: &[u8]) -> Result<(), MacError>

Check truncated tag correctness using left side bytes (i.e. tag[..n]) of calculated tag. Read more
Source§

fn verify_truncated_right(self, tag: &[u8]) -> Result<(), MacError>

Check truncated tag correctness using right side bytes (i.e. tag[n..]) of calculated tag. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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.