pub struct RollingAdler32 { /* private fields */ }
Expand description
A rolling version of the Adler32 hash, which can ‘forget’ past bytes.
Calling remove() will update the hash to the value it would have if that past byte had never been fed to the algorithm. This allows you to get the hash of a rolling window very efficiently.
Implementations§
Source§impl RollingAdler32
impl RollingAdler32
Sourcepub fn new() -> RollingAdler32
pub fn new() -> RollingAdler32
Creates an empty Adler32 context (with hash 1).
Sourcepub fn from_value(adler32: u32) -> RollingAdler32
pub fn from_value(adler32: u32) -> RollingAdler32
Creates an Adler32 context with the given initial value.
Sourcepub fn from_buffer(buffer: &[u8]) -> RollingAdler32
pub fn from_buffer(buffer: &[u8]) -> RollingAdler32
Convenience function initializing a context from the hash of a buffer.
Sourcepub fn remove(&mut self, size: usize, byte: u8)
pub fn remove(&mut self, size: usize, byte: u8)
Removes the given byte
that was fed to the algorithm size
bytes ago.
Sourcepub fn update_buffer(&mut self, buffer: &[u8])
pub fn update_buffer(&mut self, buffer: &[u8])
Feeds a vector of bytes to the algorithm to update the hash.
Trait Implementations§
Source§impl Clone for RollingAdler32
impl Clone for RollingAdler32
Source§fn clone(&self) -> RollingAdler32
fn clone(&self) -> RollingAdler32
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Default for RollingAdler32
impl Default for RollingAdler32
Source§fn default() -> RollingAdler32
fn default() -> RollingAdler32
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for RollingAdler32
impl RefUnwindSafe for RollingAdler32
impl Send for RollingAdler32
impl Sync for RollingAdler32
impl Unpin for RollingAdler32
impl UnwindSafe for RollingAdler32
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)