commit | 6e628c49cacedd19ade6410551e64cf731728061 | [log] [tgz] |
---|---|---|
author | Damien George <damien.p.george@gmail.com> | Tue Mar 25 15:27:15 2014 +0000 |
committer | Damien George <damien.p.george@gmail.com> | Tue Mar 25 15:27:15 2014 +0000 |
tree | a3a134c68f1462d2db8be06cdc541d13693c48b3 | |
parent | ffb5cfc8d8c6ce219c9cd57bd6fdd64878f2e8d0 [diff] [blame] |
py: Replace naive and teribble hash function with djb2.
diff --git a/py/makeqstrdata.py b/py/makeqstrdata.py index 934bc43..7413365 100644 --- a/py/makeqstrdata.py +++ b/py/makeqstrdata.py
@@ -18,9 +18,9 @@ # 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):