diff options
author | Damien George <damien.p.george@gmail.com> | 2014-03-25 15:27:15 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-03-25 15:27:15 +0000 |
commit | 6e628c49cacedd19ade6410551e64cf731728061 (patch) | |
tree | a3a134c68f1462d2db8be06cdc541d13693c48b3 /py/makeqstrdata.py | |
parent | ffb5cfc8d8c6ce219c9cd57bd6fdd64878f2e8d0 (diff) |
py: Replace naive and teribble hash function with djb2.
Diffstat (limited to 'py/makeqstrdata.py')
-rw-r--r-- | py/makeqstrdata.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/py/makeqstrdata.py b/py/makeqstrdata.py index 934bc43be..741336571 100644 --- a/py/makeqstrdata.py +++ b/py/makeqstrdata.py @@ -18,9 +18,9 @@ codepoint2name[ord('/')] = 'slash' # this must match the equivalent function in qstr.c def compute_hash(qstr): - hash = 0 + hash = 5381 for char in qstr: - hash += ord(char) + hash = (hash * 33) ^ ord(char) return hash & 0xffff def do_work(infiles): |