pub struct ShaDigest<'d, A, S: BorrowMut<Sha<'d>>> { /* private fields */ }Expand description
An active digest
This implementation might fail after u32::MAX/8 bytes, to increase please see ::finish() length/self.cursor usage
Implementations§
Source§impl<'d, A: ShaAlgorithm, S: BorrowMut<Sha<'d>>> ShaDigest<'d, A, S>
impl<'d, A: ShaAlgorithm, S: BorrowMut<Sha<'d>>> ShaDigest<'d, A, S>
Sourcepub fn update<'a>(&mut self, incoming: &'a [u8]) -> Result<&'a [u8], Infallible>
pub fn update<'a>(&mut self, incoming: &'a [u8]) -> Result<&'a [u8], Infallible>
Updates the SHA digest with the provided data buffer.
Sourcepub fn finish(&mut self, output: &mut [u8]) -> Result<(), Infallible>
pub fn finish(&mut self, output: &mut [u8]) -> Result<(), Infallible>
Finish of the calculation (if not already) and copy result to output
After finish() is called update()s will contribute to a new hash
which can be calculated again with finish().
Typically, output is expected to be the size of ShaAlgorithm::DIGEST_LENGTH, but smaller inputs can be given to get a “short hash”
Auto Trait Implementations§
impl<'d, A, S> Freeze for ShaDigest<'d, A, S>where
S: Freeze,
impl<'d, A, S> RefUnwindSafe for ShaDigest<'d, A, S>where
S: RefUnwindSafe,
A: RefUnwindSafe,
impl<'d, A, S> Send for ShaDigest<'d, A, S>
impl<'d, A, S> Sync for ShaDigest<'d, A, S>
impl<'d, A, S> Unpin for ShaDigest<'d, A, S>
impl<'d, A, S> UnwindSafe for ShaDigest<'d, A, S>where
S: UnwindSafe,
A: UnwindSafe,
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