To determine the lexicographical order of two sequences, one can firstly evaluate the length of their longest common prefix, then compare the first different element of the sequences. With binary search, one only needs to check whether two sequences are identical, then the whole problem can be easily solved.
Consider hashing. One can easily evaluate the hash value of a subarray of a sequence by precomuting all the hash values of the prefixes, provided that the hash is a polynomial hash. However, one cannot find the hash value of the bitwise exclusive or of two sequences by the hash value of these sequences.
Therefore, one may want to find some operation that is distributive on bitwise exclusive or. If there is any, one can use the operation and bitwise exclusive or to build something analogous to a polynomial hash, which means the new hash value of the bitwise exclusive or of two sequences is exactly the bitwise exclusive or of the hash value of the two sequences.
In fact, any Galois field of order , denoted as , is exactly what is desired. Take as an example, one way to evalutate the product in is to represent numbers as polynomials whose degree is no more than and coefficients in , and take a prime polynomial as the modulus when computing products. One such polynomial is .
The whole time complexity is , where denotes the size of the field is . The probability of collusion is .