Struct diem_crypto::hash::HashValue[][src]

pub struct HashValue { /* fields omitted */ }
Expand description

Output value of our hash function. Intentionally opaque for safety and modularity.

Implementations

The length of the hash in bytes.

The length of the hash in bits.

Create a new HashValue from a byte array.

Create from a slice (e.g. retrieved from storage).

Dumps into a vector.

Creates a zero-initialized instance.

Create a cryptographically random instance.

Creates a random instance with given rng. Useful in unit tests.

Convenience function that computes a HashValue internally equal to the sha3_256 of a byte buffer. It will handle hasher creation, data feeding and finalization.

Note this will not result in the <T as CryptoHash>::hash() for any reasonable struct T, as this computes a sha3 without any ornaments.

Returns the index-th bit in the bytes.

Returns the index-th nibble in the bytes.

Returns a HashValueBitIterator over all the bits that represent this HashValue.

Constructs a HashValue from an iterator of bits.

Returns the length of common prefix of self and other in bits.

Full hex representation of a given hash value.

Full hex representation of a given hash value with 0x prefix.

Parse a given hex string to a hash value.

Trait Implementations

Performs the conversion.

Formats the value using the given formatter.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

The resulting type after dereferencing.

Dereferences the value.

Deserialize this value from the given Serde deserializer. Read more

Will print shortened (4 bytes) hash

Formats the value using the given formatter. Read more

Performs the conversion.

The associated error which can be returned from parsing.

Parses a string s to return a value of this type. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

The returned type after indexing.

Performs the indexing (container[index]) operation. Read more

Formats the value using the given formatter.

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

Generates a hash used only for tests.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.