GeneralHashFunctions_5.py 194 B

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