Rabin–Karp slides a window over the text, updating a rolling hash in O(1). A hash match can be a collision, so it must be verified. It extends naturally to many patterns of the same length.