Expand description
Karp-Rabin rolling hash (Karp & Rabin 1987; Section 2.1.3).
Polynomial fingerprints over the Mersenne prime 2^61-1.
Full 61-bit fingerprints are used for collision-free seed comparison;
fp_to_index maps them into the bounded hash table via F mod q.
Structs§
- Rolling
Hash - Rolling hash for O(1) incremental fingerprint updates.
Functions§
- crc64_
xz - Compute CRC-64/XZ of
data; returns 8 bytes big-endian. - fingerprint
- Compute the Karp-Rabin fingerprint of data[offset..offset+p] (Eq. 1, Section 2.1.3).
- fp_
to_ index - Map a full fingerprint to a hash table index (F mod q, Section 2.1.3).
- is_
prime - Deterministic Miller-Rabin primality test.
- mod_
mersenne - Reduce a u128 value modulo the Mersenne prime 2^61-1.
- next_
prime - Smallest prime >= n.
- precompute_
bp - Precompute HASH_BASE^{p-1} mod HASH_MOD.