Struct Endian

Source
pub struct Endian<D, Bo> { /* private fields */ }
Expand description

An adapter to provide digest functions with endian-awareness.

Implementations§

Source§

impl<D, Bo> Endian<D, Bo>
where Bo: ByteOrder,

Source

pub fn byte_order_str() -> &'static str

Returns a string describing the byte order used by this Endian type instance.

This is mainly used for debugging purposes. The user should not rely on any particular output.

Source§

impl<D, Bo> Endian<D, Bo>
where D: Input + Default, Bo: ByteOrder,

Source

pub fn new() -> Self

Constructs an instance of an endian-aware hasher.

§Examples
let hasher = digest_hash::BigEndian::<Sha256>::new();
Source§

impl<D, Bo> Endian<D, Bo>

Source

pub fn into_inner(self) -> D

Consumes self and returns the underlying digest implementation.

Trait Implementations§

Source§

impl<D, Bo> BlockInput for Endian<D, Bo>
where D: BlockInput,

Source§

impl<D: Clone, Bo: Clone> Clone for Endian<D, Bo>

Source§

fn clone(&self) -> Endian<D, Bo>

Returns a duplicate 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<D, Bo> Debug for Endian<D, Bo>
where D: Debug, Bo: ByteOrder,

Source§

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

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

impl<D, Bo> Default for Endian<D, Bo>
where D: Input + Default, Bo: ByteOrder,

Source§

fn default() -> Self

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

impl<D, Bo> EndianInput for Endian<D, Bo>
where D: Input, Bo: ByteOrder,

Source§

type ByteOrder = Bo

The byte order this implementation provides. Read more
Source§

fn input_u8(&mut self, n: u8)

Feeds an unsigned 8-bit value into the digest function. Read more
Source§

fn input_i8(&mut self, n: i8)

Feeds a signed 8-bit value into the digest function. Read more
Source§

fn chain_u8(self, n: u8) -> Self
where Self: Sized,

Digest an unsigned 8-bit value in a chained manner. Read more
Source§

fn chain_i8(self, n: i8) -> Self
where Self: Sized,

Digest a signed 8-bit value in a chained manner. Read more
Source§

fn input_u16(&mut self, n: u16)

Source§

fn chain_u16(self, n: u16) -> Self
where Self: Sized,

Source§

fn input_i16(&mut self, n: i16)

Source§

fn chain_i16(self, n: i16) -> Self
where Self: Sized,

Source§

fn input_u32(&mut self, n: u32)

Source§

fn chain_u32(self, n: u32) -> Self
where Self: Sized,

Source§

fn input_i32(&mut self, n: i32)

Source§

fn chain_i32(self, n: i32) -> Self
where Self: Sized,

Source§

fn input_u64(&mut self, n: u64)

Source§

fn chain_u64(self, n: u64) -> Self
where Self: Sized,

Source§

fn input_i64(&mut self, n: i64)

Source§

fn chain_i64(self, n: i64) -> Self
where Self: Sized,

Source§

fn input_f32(&mut self, n: f32)

Source§

fn chain_f32(self, n: f32) -> Self
where Self: Sized,

Source§

fn input_f64(&mut self, n: f64)

Source§

fn chain_f64(self, n: f64) -> Self
where Self: Sized,

Source§

impl<D, Bo> FixedOutput for Endian<D, Bo>
where D: FixedOutput,

Source§

type OutputSize = <D as FixedOutput>::OutputSize

Source§

fn fixed_result(self) -> GenericArray<u8, Self::OutputSize>

Retrieve result and consume hasher instance.
Source§

impl<D, Bo> From<D> for Endian<D, Bo>
where D: Input, Bo: ByteOrder,

Source§

fn from(digest: D) -> Self

Converts to this type from the input type.
Source§

impl<D, Bo> Input for Endian<D, Bo>
where D: Input,

Source§

fn input<B: AsRef<[u8]>>(&mut self, data: B)

Digest input data. Read more
Source§

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

Digest input data in a chained manner.
Source§

impl<D, Bo> Reset for Endian<D, Bo>
where D: Reset,

Source§

fn reset(&mut self)

Reset hasher instance to its initial state and return current state.

Auto Trait Implementations§

§

impl<D, Bo> Freeze for Endian<D, Bo>
where D: Freeze,

§

impl<D, Bo> RefUnwindSafe for Endian<D, Bo>

§

impl<D, Bo> Send for Endian<D, Bo>
where D: Send, Bo: Send,

§

impl<D, Bo> Sync for Endian<D, Bo>
where D: Sync, Bo: Sync,

§

impl<D, Bo> Unpin for Endian<D, Bo>
where D: Unpin, Bo: Unpin,

§

impl<D, Bo> UnwindSafe for Endian<D, Bo>
where D: UnwindSafe, Bo: UnwindSafe,

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, dest: *mut u8)

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

impl<D> Digest for D
where D: Input + FixedOutput + Reset + Clone + Default,

Source§

type OutputSize = <D as FixedOutput>::OutputSize

Source§

fn new() -> D

Create new hasher instance
Source§

fn input<B>(&mut self, data: B)
where B: AsRef<[u8]>,

Digest input data. Read more
Source§

fn chain<B>(self, data: B) -> D
where B: AsRef<[u8]>,

Digest input data in a chained manner.
Source§

fn result(self) -> GenericArray<u8, <D as Digest>::OutputSize>

Retrieve result and consume hasher instance.
Source§

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

Retrieve result and reset hasher instance. Read more
Source§

fn reset(&mut self)

Reset hasher instance to its initial state.
Source§

fn output_size() -> usize

Get output size of the hasher
Source§

fn digest(data: &[u8]) -> GenericArray<u8, <D as Digest>::OutputSize>

Convenience function to compute hash of the data. It will handle hasher creation, data feeding and finalization. Read more
Source§

impl<D> DynDigest for D
where D: Input + FixedOutput + Reset + Clone + 'static,

Source§

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

Digest input data. Read more
Source§

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

Retrieve result and reset hasher instance
Source§

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

Retrieve result and consume boxed hasher instance
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> 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.