Struct tlfs_crdt::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
This implementation is constant-time.
This implementation is constant-time if the target is 32 bytes long.
This implementation is constant-time.
Auto Trait Implementations
impl RefUnwindSafe for Hash
impl UnwindSafe for Hash
Blanket Implementations
type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Converts some archived metadata to the pointer metadata for itself.
Mutably borrows from an owned value. Read more
impl<F, W, T, D> Deserialize<With<T, W>, D> for F where
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
impl<F, W, T, D> Deserialize<With<T, W>, D> for F where
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more