RabinFingerprint
Defined in: rolling/rabin-fingerprint.ts:41
Rabin fingerprint: a GF(2) polynomial-division rolling hash (Rabin, 1981),
mathematically the same per-byte reduction as a non-reflected CRC (see
_gf2-polynomial.ts), plus a sliding window — the departing byte’s
contribution is precomputed per byte value at construction time
(removalTable_[byte] = the fingerprint of byte followed by windowSize - 1 zero bytes) and XORed out before the incoming byte is folded in, following
the same construction restic’s chunker package uses for content-defined
chunking.
Implements
Section titled “Implements”IRollingHash<bigint>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new RabinFingerprint(
windowSize,options?):RabinFingerprint
Defined in: rolling/rabin-fingerprint.ts:52
Parameters
Section titled “Parameters”windowSize
Section titled “windowSize”number
options?
Section titled “options?”Returns
Section titled “Returns”RabinFingerprint
Properties
Section titled “Properties”windowSize
Section titled “windowSize”
readonlywindowSize:number
Defined in: rolling/rabin-fingerprint.ts:42
Accessors
Section titled “Accessors”Get Signature
Section titled “Get Signature”get value():
bigint
Defined in: rolling/rabin-fingerprint.ts:81
The rolling hash’s current value.
Returns
Section titled “Returns”bigint
The rolling hash’s current value.
Implementation of
Section titled “Implementation of”Methods
Section titled “Methods”push()
Section titled “push()”push(
byteIn):bigint
Defined in: rolling/rabin-fingerprint.ts:85
Feeds one more byte into the window, returning the updated value.
Complexity: O(1).
Parameters
Section titled “Parameters”byteIn
Section titled “byteIn”number
The next byte, 0-255.
Returns
Section titled “Returns”bigint