summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Reifschneider <jafo00@gmail.com>2023-04-15 19:57:07 -0600
committerGitHub <noreply@github.com>2023-04-15 19:57:07 -0600
commit9320f7246df8c71f45ca03773db85400fe4c1e15 (patch)
tree86c493b6ce40058673a79b3cb8094a115e603d16
parentcea9fd0abdbf84ef6c9d7693c2e65268672579b5 (diff)
parent9cae205236f6585d388731711bffebe4330177c6 (diff)
downloadpython-memcached-9320f7246df8c71f45ca03773db85400fe4c1e15.tar.gz
Merge pull request #152 from hyperair/fix-crc-0-hash
Fix cmemcahe_hash 0 values being translated to 1. For example "ob" would hash to 0 and then get converted to 1. Looks like this dated back to 2009, the original code we imported for that hash function.
-rw-r--r--memcache.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/memcache.py b/memcache.py
index 53da53b..ea1080e 100644
--- a/memcache.py
+++ b/memcache.py
@@ -66,7 +66,7 @@ else:
def cmemcache_hash(key):
- return (((binascii.crc32(key) & 0xffffffff) >> 16) & 0x7fff) or 1
+ return ((binascii.crc32(key) & 0xffffffff) >> 16) & 0x7fff
serverHashFunction = cmemcache_hash