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. See finish()
length/self.cursor usage to increase the limit.
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>
Finishes the calculation (if not already finished) and copies the result to output.
After finish() is called, update()s 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: BorrowMut<Sha<'d>>> FixedOutput for ShaDigest<'d, A, S>
Available on crate feature unstable only.
impl<'d, A: ShaAlgorithm, S: BorrowMut<Sha<'d>>> FixedOutput for ShaDigest<'d, A, S>
Available on crate feature
unstable only.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: BorrowMut<Sha<'d>>> FixedOutput for ShaDigest<'d, A, S>
Available on crate feature unstable only.
impl<'d, A: ShaAlgorithm, S: BorrowMut<Sha<'d>>> FixedOutput for ShaDigest<'d, A, S>
Available on crate feature
unstable only.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) -> Array<u8, Self::OutputSize>
fn finalize_fixed(self) -> Array<u8, Self::OutputSize>
Retrieve result and consume the hasher instance.
impl<'d, A: ShaAlgorithm, S: BorrowMut<Sha<'d>>> HashMarker for ShaDigest<'d, A, S>
Available on crate feature
unstable only.digest has a blanket trait implementation for Digest for any
element that implements FixedOutput + Default + Update + HashMarker.
impl<'d, A: ShaAlgorithm, S: BorrowMut<Sha<'d>>> HashMarker for ShaDigest<'d, A, S>
Available on crate feature
unstable only.Source§impl<'d, A: ShaAlgorithm, S: BorrowMut<Sha<'d>>> OutputSizeUser for ShaDigest<'d, A, S>
Available on crate feature unstable only.
impl<'d, A: ShaAlgorithm, S: BorrowMut<Sha<'d>>> OutputSizeUser for ShaDigest<'d, A, S>
Available on crate feature
unstable only.Source§type OutputSize = <A as ShaAlgorithm>::Digest010OutputSize
type OutputSize = <A as ShaAlgorithm>::Digest010OutputSize
Size of the output in bytes.
Source§fn output_size() -> usize
fn output_size() -> usize
Return output size in bytes.
Source§impl<'d, A: ShaAlgorithm, S: BorrowMut<Sha<'d>>> OutputSizeUser for ShaDigest<'d, A, S>
Available on crate feature unstable only.
impl<'d, A: ShaAlgorithm, S: BorrowMut<Sha<'d>>> OutputSizeUser for ShaDigest<'d, A, S>
Available on crate feature
unstable only.Source§type OutputSize = <A as ShaAlgorithm>::Digest011OutputSize
type OutputSize = <A as ShaAlgorithm>::Digest011OutputSize
Size of the output in bytes.
Source§fn output_size() -> usize
fn output_size() -> usize
Return output size in bytes.
Source§impl<'d, A: ShaAlgorithm, S: BorrowMut<Sha<'d>>> Update for ShaDigest<'d, A, S>
Available on crate feature unstable only.
impl<'d, A: ShaAlgorithm, S: BorrowMut<Sha<'d>>> Update for ShaDigest<'d, A, S>
Available on crate feature
unstable only.Auto Trait Implementations§
impl<'d, A, S> Freeze for ShaDigest<'d, A, S>
impl<'d, A, S> RefUnwindSafe for ShaDigest<'d, A, S>
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> UnsafeUnpin for ShaDigest<'d, A, S>
impl<'d, A, S> UnwindSafe for ShaDigest<'d, A, S>
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