dach

Trait RollingHasher

source
pub trait RollingHasher {
    type Hash;

    // Required methods
    fn new(block_size: usize) -> Self;
    fn reset(&mut self, block_size: usize);
    fn update(&mut self, block: &[u8], block_size: usize);
    fn rotate(&mut self, old: u8, new: u8, block_size: usize);
    fn value(&self) -> Self::Hash;
}
Expand description

Used to make RollingHash generic.

This is implemented by the Adler32 algorithm and both variants of the cyclic poly 32 algorithm. The implementation of cyclic poly 23 is in a Box due to the large size of the struct (1KiB and 2KiB for the 32- and 64-bit implementations respectively).

Required Associated Types§

source

type Hash

The hash returned from this hasher.

Required Methods§

source

fn new(block_size: usize) -> Self

Create a new hasher.

source

fn reset(&mut self, block_size: usize)

Reset the inner state. If the struct provides no such functionality, consider overriding the current value with a new instance.

source

fn update(&mut self, block: &[u8], block_size: