Struct fog_crypto::hash::Hash
source · [−]pub struct Hash { /* private fields */ }
Expand description
Crytographically secure hash of data.
Offers constant time equality check (non-constant time ordinal checks). A version byte is used to indicate what hash algorithm should be used. Uses base58 encoding when displayed, unless overridden with hex formatting or debug formatting.
Supported Versions
- 1: Blake2B hash with 32 bytes of digest
Example
// Create a new hash from raw bytes
let hash = Hash::new(b"I am the entire data sequence");
println!("Hash(Base58): {}", hash);
Implementations
Create a new hash from raw data, using the recommended algorithm.
Create a hash with a specific algorithm version. You should avoid this except when working through a upgrade process, where you may briefly need to support more than one version. Fails if the version isn’t supported.
The raw digest from the hash, without the version byte.
Attempt to parse a Base58-encoded hash type. Fails if the string isn’t valid Base58 or the hash itself isn’t valid.
Trait Implementations
Deserialize this value from the given Serde deserializer. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl RefUnwindSafe for Hash
impl UnwindSafe for Hash
Blanket Implementations
Mutably borrows from an owned value. Read more