Skip to content

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.”

new GearHash(): GearHash

GearHash

get value(): bigint

Defined in: rolling/gear-hash.ts:62

The rolling hash’s current value.

bigint

The rolling hash’s current value.

IRollingHash.value

push(byteIn): bigint

Defined in: rolling/gear-hash.ts:66

Feeds one more byte into the window, returning the updated value.

Complexity: O(1).

number

The next byte, 0-255.

bigint

IRollingHash.push