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§
Sourcefn hash<H>(&self, digest: &mut H)where
H: EndianInput,
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.