Rolling hash
A rolling hash updates a fingerprint incrementally as the input window or stream advances, instead of recomputing it over the entire input each time.
Restic's chunker uses Rabin fingerprints for boundary selection. Such a boundary fingerprint is not a cryptographic identifier of the complete chunk; content identity needs a separate check. [1]
Gear fingerprints illustrate why an advancing stream need not supply independent boundary trials. In the pinned right-shift FastCDC experiment, repeating one byte drives the state toward an odd fixed point; both low-bit zero masks then fail. A transient match explains the 0x5D exception. This behavior belongs to the tested recurrence, table and masks, not to every rolling hash. [3]
Rsync uses a rolling checksum to search for fixed-length basis blocks at arbitrary source offsets, not to choose content-defined boundaries. Its original recurrence uses modulus 65536 and is Adler-32-inspired, rather than identical to Adler-32. A candidate checksum match requires a separate content check. [4]
Relations
Citations
- Restic project. Chunker: Rabin-based content-defined chunking implementation and explanation.
- Hesela. Exhaustive constant-byte FastCDC experiment: pinned 1.7.0 Python API, source hashes, exact reconstruction and independent recurrence checks.
- Tridgell and Mackerras. The rsync algorithm: rolling checksum, 1996.