pub struct ShaDigest<'d, A, S: Borrow<Sha<'d>>> { /* private fields */ }
Available on crate feature
unstable
only.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: Borrow<Sha<'d>>> ShaDigest<'d, A, S>
impl<'d, A: ShaAlgorithm, S: Borrow<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”