rolling_checksum_py_mod module

Provides a very simple rolling checksum for file data.

class rolling_checksum_py_mod.Rolling_checksum(width=607, multiplicand=7, modulus=3677, addend=66041)[source]

Bases: object

Compute a very simple, fast, rolling checksum.

We don’t maintain a list of bytes or anything - we just produce checksums on demand. Inspired by linear congruential random number generation. It’s not quite the same thing though.

add_byte(byte)[source]

Add a byte into our rolling checksum function.

get_modulus()[source]

Return the modulus.

rolling_checksum_py_mod.min_max_chunker(file_)[source]

Make sure chunk sizes are above and below a pair of thresholds.

rolling_checksum_py_mod.n_level_chunker(file_, levels=1)[source]

Divide a file up into portions when we get 3 in-range checksums in a row.