Buzhash
Defined in: rolling/buzhash.ts:59
Buzhash / cyclic-polynomial rolling hash (Cohen 1997): each byte contributes
SUBSTITUTION_TABLE[byte], rotated left by its distance from the front of a
fixed-size window; sliding the window rotates the whole accumulator left by
one and XORs in the new byte’s contribution while XORing out the departing
byte’s (pre-rotated by windowSize positions, so removal costs one table
lookup, not a runtime rotate).
Implements
Section titled “Implements”IRollingHash<number>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Buzhash(
windowSize):Buzhash
Defined in: rolling/buzhash.ts:68
Parameters
Section titled “Parameters”windowSize
Section titled “windowSize”number
Returns
Section titled “Returns”Buzhash
Properties
Section titled “Properties”windowSize
Section titled “windowSize”
readonlywindowSize:number
Defined in: rolling/buzhash.ts:60
Accessors
Section titled “Accessors”Get Signature
Section titled “Get Signature”get value():
number
Defined in: rolling/buzhash.ts:87
The rolling hash’s current value.
Returns
Section titled “Returns”number
The rolling hash’s current value.
Implementation of
Section titled “Implementation of”Methods
Section titled “Methods”push()
Section titled “push()”push(
byteIn):number
Defined in: rolling/buzhash.ts:91
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”number