Trait Hash

Source
pub trait Hash {
    // Required method
    fn hash<H>(&self, digest: &mut H)
       where H: EndianInput;
}
Expand description

A cryptographically hashable type.

This trait is similar to std::hash::Hash, with some differences:

  • The choice of provided trait implementations discourages hashing of machine-dependent types, or types without an unambiguous byte stream representation.
  • The standard sequential byte containers are transparent to hashing.
  • The intended recipients of data for hashing are cryptographic hash functions that implement traits defined in crate digest.

This trait can be implemented for a user-defined type to provide it with a cryptographically stable representation for secure hashing.

Required Methods§

Source

fn hash<H>(&self, digest: &mut H)
where H: EndianInput,

Feeds this value into the given digest function.

For multi-byte data member values, the byte order is imposed by the implementation of EndianInput that the digest function provides.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Hash for f32

Source§

fn hash<H>(&self, digest: &mut H)
where H: EndianInput,

Source§

impl Hash for f64

Source§

fn hash<H>(&self, digest: &mut H)
where H: EndianInput,

Source§

impl Hash for i8

Source§

fn hash<H>(&self, digest: &mut H)
where H: EndianInput,

Source§

impl Hash for i16

Source§

fn hash<H>(&self, digest: &mut H)
where H: EndianInput,

Source§

impl Hash for i32

Source§

fn hash<H>(&self, digest: &mut H)
where H: EndianInput,

Source§

impl Hash for i64

Source§

fn hash<H>(&self, digest: &mut H)
where H: EndianInput,

Source§

impl Hash for u8

Source§

fn hash<H>(&self, digest: &mut H)
where H: EndianInput,

Source§

impl Hash for u16

Source§

fn hash<H>(&self, digest: &mut H)
where H: EndianInput,

Source§

impl Hash for u32

Source§

fn hash<H>(&self, digest: &mut H)
where H: EndianInput,

Source§

impl Hash for u64

Source§

fn hash<H>(&self, digest: &mut H)
where H: EndianInput,

Source§

impl<'a, B> Hash for Cow<'a, B>
where B: Hash + ToOwned + ?Sized, B::Owned: Hash,

Source§

fn hash<H>(&self, digest: &mut H)
where H: EndianInput,

Source§

impl<'a, T> Hash for &'a T
where T: Hash + ?Sized,

Source§

fn hash<H>(&self, digest: &mut H)
where H: EndianInput,

Source§

impl<N> Hash for GenericArray<i8, N>
where N: ArrayLength<i8>,

Source§

fn hash<H>(&self, digest: &mut H)
where H: EndianInput,

Source§

impl<N> Hash for GenericArray<u8, N>
where N: ArrayLength<u8>,

Source§

fn hash<H>(&self, digest: &mut H)
where H: EndianInput,

Source§

impl<T> Hash for Box<T>
where T: Hash + ?Sized,

Source§

fn hash<H>(&self, digest: &mut H)
where H: EndianInput,

Source§

impl<T> Hash for Rc<T>
where T: Hash + ?Sized,

Source§

fn hash<H>(&self, digest: &mut H)
where H: EndianInput,

Source§

impl<T> Hash for Arc<T>
where T: Hash + ?Sized,

Source§

fn hash<H>(&self, digest: &mut H)
where H: EndianInput,

Implementors§