def bkdr_hash(key): seed = 131 # 31 131 1313 13131 131313 etc.. hash_value = 0 for i in range(len(key)): hash_value = (hash_value * seed) + ord(key[i]) return hash_value