def djb_hash(key): hash_value = 5381 for i in range(len(key)): hash_value = ((hash_value << 5) + hash_value) + ord(key[i]) return hash_value