Struct blake3::Hash[][src]

pub struct Hash(_);
Expand description

An output of the default size, 32 bytes, which provides constant-time equality checking.

Hash implements From and Into for [u8; 32], and it provides an explicit as_bytes method returning &[u8; 32]. However, byte arrays and slices don’t provide constant-time equality checking, which is often a security requirement in software that handles private data. Hash doesn’t implement Deref or AsRef, to avoid situations where a type conversion happens implicitly and the constant-time property is accidentally lost.

Hash provides the to_hex and from_hex methods for converting to and from hexadecimal. It also implements Display and FromStr.

Implementations

The raw bytes of the Hash. Note that byte arrays don’t provide constant-time equality checking, so if you need to compare hashes, prefer the Hash type.

Encode a Hash in lowercase hexadecimal.

The returned ArrayString is a fixed size and doesn’t allocate memory on the heap. Note that ArrayString doesn’t provide constant-time equality checking, so if you need to compare hashes, prefer the Hash type.

Decode a Hash from hexadecimal. Both uppercase and lowercase ASCII bytes are supported.

Any byte outside the ranges '0'...'9', 'a'...'f', and 'A'...'F' results in an error. An input length other than 64 also results in an error.

Note that Hash also implements FromStr, so Hash::from_hex("...") is equivalent to "...".parse().

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

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

This implementation is constant-time.

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

This method tests for !=.

This implementation is constant-time if the target is 32 bytes long.

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

This method tests for !=.

This implementation is constant-time.

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

This method tests for !=.

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.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

Should always be Self

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.