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 for Hash
impl PartialEq for Hash
This implementation is constant time, if the two hashes are the same length.
impl Copy for Hash
impl Eq for Hash
Auto Trait Implementations§
impl Freeze for Hash
impl RefUnwindSafe for Hash
impl Send for Hash
impl Sync for Hash
impl Unpin 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
source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)