Pearson_Hashing Pearson_Hashing

Pearson Hashing - Definition

Pearson 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[hash_value ^ character]
    return hash_value
Copyright 2009 WordIQ.com - Privacy Policy  :: Terms of Use  :: Contact Us  :: About Us
This article is licensed under the GNU Free Documentation License. It uses material from the this Wikipedia article.