jweinst1
2/14/2016 - 1:35 AM

hashing object for python

hashing object for python

#hash function that assigns between 1 and 500

class hasher:
    
    def __init__(self):
        self.symbols = list("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890~!@#$%^&*()_+-=[]{}|:;<>,./?")
        self.sym_table = {}
        i=0
        for elem in self.symbols:
            self.sym_table[elem] = i
            i += 1
        self.hash_table = [None for elem in range(501)]