pub struct DataHasher { /* private fields */ }Expand description
Streaming Data-Code generator.
Incrementally processes data with content-defined chunking (CDC) and
MinHash to produce an ISCC Data-Code identical to gen_data_code_v0
for the same byte stream. Uses a persistent internal buffer to avoid
per-call heap allocations.
Implementations§
Source§impl DataHasher
impl DataHasher
Sourcepub fn update(&mut self, data: &[u8])
pub fn update(&mut self, data: &[u8])
Push data into the hasher.
Appends data to the internal buffer (which starts with the retained tail from the previous call), runs CDC, hashes all complete chunks, and shifts the last chunk (tail) to the front of the buffer for the next call. The buffer is reused across calls to avoid allocations.
Sourcepub fn finalize(self, bits: u32) -> IsccResult<DataCodeResult>
pub fn finalize(self, bits: u32) -> IsccResult<DataCodeResult>
Consume the hasher and produce a Data-Code result.
Equivalent to calling gen_data_code_v0 with the concatenation
of all data passed to update.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DataHasher
impl RefUnwindSafe for DataHasher
impl Send for DataHasher
impl Sync for DataHasher
impl Unpin for DataHasher
impl UnsafeUnpin for DataHasher
impl UnwindSafe for DataHasher
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