Struct blake2b_simd::Hash
source · pub struct Hash { /* private fields */ }
Expand description
A finalized BLAKE2 hash, with constant-time equality.
Implementations§
source§impl Hash
impl Hash
sourcepub fn as_bytes(&self) -> &[u8] ⓘ
pub fn as_bytes(&self) -> &[u8] ⓘ
Convert the hash to a byte slice. Note that if you’re using BLAKE2 as a MAC, you need
constant time equality, which &[u8]
doesn’t provide.
sourcepub fn as_array(&self) -> &[u8; 64]
pub fn as_array(&self) -> &[u8; 64]
Convert the hash to a byte array. Note that if you’re using BLAKE2 as a
MAC, you need constant time equality, which arrays don’t provide. This
panics in debug mode if the length of the hash isn’t OUTBYTES
.
sourcepub fn to_hex(&self) -> ArrayString<{ _ }>
pub fn to_hex(&self) -> ArrayString<{ _ }>
Convert the hash to a lowercase hexadecimal
ArrayString
.
Trait Implementations§
source§impl PartialEq<[u8]> for Hash
impl PartialEq<[u8]> for Hash
This implementation is constant time, if the slice is the same length as the hash.
source§impl PartialEq<Hash> for Hash
impl PartialEq<Hash> for Hash
This implementation is constant time, if the two hashes are the same length.