Struct fog_pack::types::Hash [−][src]
pub struct Hash { /* fields omitted */ }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.
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
pub fn deserialize<D>(
deserializer: D
) -> Result<Hash, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
pub fn deserialize<D>(
deserializer: D
) -> Result<Hash, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
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
pub fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
pub fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations
impl RefUnwindSafe for Hash
impl UnwindSafe for Hash
Blanket Implementations
Mutably borrows from an owned value. Read more
type Output = T
type Output = T
Should always be Self