GearHash
Defined in: rolling/gear-hash.ts:59
Gear hash: hash = (hash << 1) + table[byteIn] over a 64-bit accumulator — a
byte’s contribution shifts out of the tracked width after roughly 64 pushes
instead of being explicitly removed, so unlike
“./buzhash.js”.Buzhash,
“./rabin-fingerprint.js”.RabinFingerprint and
“./rabin-karp-hash.js”.RabinKarpHash, there is no fixed window and no
windowSize property. Purpose-built for FastCDC-style chunk-boundary
detection (masking the top bits of value), not “the hash of exactly these
last N bytes.”
Implements
Section titled “Implements”IRollingHash<bigint>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new GearHash():
GearHash
Returns
Section titled “Returns”GearHash
Accessors
Section titled “Accessors”Get Signature
Section titled “Get Signature”get value():
bigint
Defined in: rolling/gear-hash.ts:62
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/gear-hash.ts:66
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