tab_hash_3.py 267 B

12345678910
  1. def tab_gash(key):
  2. hash = 0
  3. # i = 0
  4. for c in key:
  5. c_int = ord(c)
  6. hash_partial = hmap[(c_int + hash) & 0xFF] ^ c_int
  7. hash ^= hash_partial
  8. # print(f"{c} : {hash_partial} : {hash}")
  9. # i+= hmap[i & 0xFF]
  10. return hash