GeneralHashFunctions_7.py 160 B

12345
  1. def djb_hash(key):
  2. hash_value = 5381
  3. for i in range(len(key)):
  4. hash_value = ((hash_value << 5) + hash_value) + ord(key[i])
  5. return hash_value