[−][src]Trait digest::Digest
The Digest
trait specifies an interface common for digest functions.
It's a convenience wrapper around Update
, FixedOutput
, Reset
,
Clone
, and Default
traits. It also provides additional convenience methods.
Associated Types
type OutputSize: ArrayLength<u8>
[src]
Output size for Digest
Required methods
pub fn new() -> Self
[src]
Create new hasher instance
pub fn update(&mut self, data: impl AsRef<[u8]>)
[src]
Digest data, updating the internal state.
This method can be called repeatedly for use with streaming messages.
pub fn chain(self, data: impl AsRef<[u8]>) -> Self where
Self: Sized,
[src]
Self: Sized,
Digest input data in a chained manner.
pub fn finalize(self) -> Output<Self>
[src]
Retrieve result and consume hasher instance.
pub fn finalize_reset(&mut self) -> Output<Self>
[src]
Retrieve result and reset hasher instance.
This method sometimes can be more efficient compared to hasher re-creation.
pub fn finalize_into(self, out: &mut GenericArray<u8, Self::OutputSize>)
[src]
Write result into provided array and consume the hasher instance.
pub fn finalize_into_reset(
&mut self,
out: &mut GenericArray<u8, Self::OutputSize>
)
[src]
&mut self,
out: &mut GenericArray<u8, Self::OutputSize>
)
Write result into provided array and reset the hasher instance.
pub fn reset(&mut self)
[src]
Reset hasher instance to its initial state.
pub fn output_size() -> usize
[src]
Get output size of the hasher
pub fn digest(data: &[u8]) -> Output<Self>
[src]
Convenience function to compute hash of the data
. It will handle
hasher creation, data feeding and finalization.
Example:
println!("{:x}", sha2::Sha256::digest(b"Hello world"));
Implementors
impl<D: Update + FixedOutput + Reset + Clone + Default> Digest for D
[src]
type OutputSize = Self::OutputSize
pub fn new() -> Self
[src]
pub fn update(&mut self, data: impl AsRef<[u8]>)
[src]
pub fn chain(mut self: Self, data: impl AsRef<[u8]>) -> Self where
Self: Sized,
[src]
Self: Sized,