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”
Trait Implementations§
Source§impl<'d, A: ShaAlgorithm, S: Borrow<Sha<'d>>> FixedOutput for ShaDigest<'d, A, S>
impl<'d, A: ShaAlgorithm, S: Borrow<Sha<'d>>> FixedOutput for ShaDigest<'d, A, S>
Source§fn finalize_into(self, out: &mut Output<Self>)
fn finalize_into(self, out: &mut Output<Self>)
Consume value and write result into provided array.
Source§fn finalize_fixed(self) -> GenericArray<u8, Self::OutputSize>
fn finalize_fixed(self) -> GenericArray<u8, Self::OutputSize>
Retrieve result and consume the hasher instance.
Source§impl<'d, A: ShaAlgorithm, S: Borrow<Sha<'d>>> OutputSizeUser for ShaDigest<'d, A, S>
impl<'d, A: ShaAlgorithm, S: Borrow<Sha<'d>>> OutputSizeUser for ShaDigest<'d, A, S>
Source§type OutputSize = <A as ShaAlgorithm>::DigestOutputSize
type OutputSize = <A as ShaAlgorithm>::DigestOutputSize
Size of the output in bytes.
Source§fn output_size() -> usize
fn output_size() -> usize
Return output size in bytes.
impl<'d, A: ShaAlgorithm, S: Borrow<Sha<'d>>> HashMarker for ShaDigest<'d, A, S>
implement digest traits if digest feature is present. Note: digest has a blanket trait implementation for digest::Digest for any element that implements FixedOutput + Default + Update + HashMarker