a hash function is a function which converts every string into a numeric value, called its "hash value"; for example, we might have codice_1. if two strings are equal, their hash values are also equal. for a well-designed hash function, the opposite is true, in an approximate sense: strings that are unequal are very unlikely to have equal hash values. the rabin–karp algorithm proceeds by computing, at each position of the text, the hash value of a string starting at that position with the same length as the pattern. if this hash value equals the hash value of the pattern, it performs a full comparison at that position.