Skip to content

IRollingHash

Defined in: rolling/rolling-hash.ts:10

Shared contract for every incremental/rolling hash in this package: state mutates as a byte window slides past, and a long-lived instance is pushed one byte at a time — unlike the rest of this package’s one-shot (data) => digest functions. Nothing beyond push/value is guaranteed across every implementation (Gear hash has no fixed window), so nothing else is on this interface; windowed implementations (Buzhash, Rabin fingerprint, Rabin-Karp) each additionally expose their own readonly windowSize: number.

R extends number | bigint = number

readonly value: R

Defined in: rolling/rolling-hash.ts:12

The rolling hash’s current value.

push(byteIn): R

Defined in: rolling/rolling-hash.ts:21

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

Complexity: O(1).

number

The next byte, 0-255.

R