pub trait Hashed: Sized {
type Algorithm: Digest<OutputSize = Self::OutputSize> + Send;
type OutputSize: ArrayLength<u8> + Unsigned;
// Required method
fn from_digest(output: GenericArray<u8, Self::OutputSize>) -> Self;
}Expand description
This trait provides a formal representation of actual hash values.
This trait is called Hashed because Rust already has a trait called
Hash, which is used for hashing keys in hash maps. To avoid confusion,
this trait is called Hashed which hopefully makes it clear that it
represents the result of a hashing algorithm, and not the hashable type or
the algorithm itself.
Required Associated Types§
Sourcetype Algorithm: Digest<OutputSize = Self::OutputSize> + Send
type Algorithm: Digest<OutputSize = Self::OutputSize> + Send
The hashing algorithm to use produce the hash.
Sourcetype OutputSize: ArrayLength<u8> + Unsigned
type OutputSize: ArrayLength<u8> + Unsigned
The output size of the hashing algorithm.
Required Methods§
Sourcefn from_digest(output: GenericArray<u8, Self::OutputSize>) -> Self
fn from_digest(output: GenericArray<u8, Self::OutputSize>) -> Self
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.