|
|
Pearson HashingPearson hashing is a way of producing random numbers. In 1990, Peter K. Pearson published a pseudo-random walk hash algorithm which produces integers from 0 to 255, using a combination of XOR and a 256-entry non-linear permutation table. Pearson hashing can often be used with a specially selected non-linear permutation table to make a perfect hash function: this combination is known as perfect Pearson hashing. In the Python programming language, the hash algorithm can be implemented as follows (assuming that permutation_table is defined externally): def hash(input): hash_value = len(input) % 256 for character in input: character = ord(character) # ord() gets the character's byte value hash_value = permutation_table^ character return hash_value
|
 |