truncate nickname hash operations to 64bit

This commit is contained in:
jesopo 2019-11-18 14:09:47 +00:00
parent a8b1bd95f7
commit d89a3125ab

View file

@ -50,7 +50,7 @@ def hash_colorize(s: str):
for i, char in enumerate(s): for i, char in enumerate(s):
if char in HASH_STOP and 0 < i < (len(s)-1): if char in HASH_STOP and 0 < i < (len(s)-1):
break break
hash ^= (hash<<5)+(hash>>2)+ord(char) hash ^= ((hash<<5)+(hash>>2)+ord(char))&0xFFFFFFFFFFFFFFFF
return color(s, HASH_COLORS[hash%len(HASH_COLORS)]) return color(s, HASH_COLORS[hash%len(HASH_COLORS)])