Belt of letters with the hash window
Window hash H(i) along the text

Rabin-Karp Rolling Hash String Search: Hash Along the Text (2D)

A belt of wooden letter tiles slides under a brass reading frame while a rolling polynomial hash is updated in constant time per step. Change the text length, pattern length, alphabet, base and modulus to see hash hits, true matches, spurious collisions and how many letter comparisons Rabin-Karp saves against the naive search. Blender-built tiles and frame, with numerical checks built in.

Made with 🟠 Blender