pub struct StreamingHasher { /* private fields */ }Expand description
Incremental hasher that computes MD5 and optionally additional checksums over a stream of data chunks.
§Examples
use rustack_s3_core::checksums::{ChecksumAlgorithm, StreamingHasher};
let mut hasher = StreamingHasher::new(&[ChecksumAlgorithm::Sha256]);
hasher.update(b"hello ");
hasher.update(b"world");
let result = hasher.finish();
assert!(!result.md5_hex.is_empty());
assert_eq!(result.checksums.len(), 1);Implementations§
Source§impl StreamingHasher
impl StreamingHasher
Sourcepub fn new(algorithms: &[ChecksumAlgorithm]) -> Self
pub fn new(algorithms: &[ChecksumAlgorithm]) -> Self
Create a new streaming hasher.
MD5 is always computed. Provide additional algorithms in algorithms
to compute extra checksums.
Sourcepub fn finish(self) -> HasherResult
pub fn finish(self) -> HasherResult
Finalize the hasher and return the results.
This consumes the hasher.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for StreamingHasher
impl RefUnwindSafe for StreamingHasher
impl Send for StreamingHasher
impl Sync for StreamingHasher
impl Unpin for StreamingHasher
impl UnsafeUnpin for StreamingHasher
impl UnwindSafe for StreamingHasher
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