pub struct TupleHash128 { /* private fields */ }Expand description
SP 800-185 TupleHash128: hashes a sequence of strings unambiguously.
Hashing a || b cannot distinguish ("abc", "d") from ("ab", "cd"),
and a protocol that concatenates fields before hashing them has a
forgery waiting in it. TupleHash length-prefixes every element, so
distinct tuples always hash distinctly.
Implementations§
Source§impl TupleHash128
impl TupleHash128
Sourcepub fn update(&mut self, element: &[u8])
pub fn update(&mut self, element: &[u8])
Add one element of the tuple.
Each element is length-prefixed, which is the entire point: see the type documentation.
Sourcepub fn finalize(self, out: &mut [u8])
pub fn finalize(self, out: &mut [u8])
Finish with a fixed-length output, binding the length in.
Sourcepub fn finalize_xof(self, out: &mut [u8])
pub fn finalize_xof(self, out: &mut [u8])
Finish in XOF mode, where the output is a stream.
Trait Implementations§
Source§impl Algorithm for TupleHash128
impl Algorithm for TupleHash128
Source§impl Clone for TupleHash128
impl Clone for TupleHash128
Auto Trait Implementations§
impl Freeze for TupleHash128
impl RefUnwindSafe for TupleHash128
impl Send for TupleHash128
impl Sync for TupleHash128
impl Unpin for TupleHash128
impl UnsafeUnpin for TupleHash128
impl UnwindSafe for TupleHash128
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