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; 32]
pub fn as_array(&self) -> &[u8; 32]
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§
impl Copy for Hash
impl Eq for Hash
Source§impl PartialEq for Hash
This implementation is constant time, if the two hashes are the same length.
impl PartialEq for Hash
This implementation is constant time, if the two hashes are the same length.
Auto Trait Implementations§
impl Freeze for Hash
impl RefUnwindSafe for Hash
impl Send for Hash
impl Sync for Hash
impl Unpin for Hash
impl UnsafeUnpin for Hash
impl UnwindSafe for Hash
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more