GeneralHashFunctions_1.py 185 B

12345678
  1. def rs_hash(key):
  2. a = 378551
  3. b = 63689
  4. hash_value = 0
  5. for i in range(len(key)):
  6. hash_value = hash_value * a + ord(key[i])
  7. a = a * b
  8. return hash_value