HASH_STOP should still be respected if last character

This commit is contained in:
jesopo 2019-11-19 14:43:24 +00:00
parent 2336695f4e
commit 554f21a84c

View file

@ -47,7 +47,7 @@ HASH_COLORS = [consts.CYAN, consts.PURPLE, consts.GREEN, consts.ORANGE,
def hash_colorize(s: str):
hash = 5381
for i, char in enumerate(s):
if char in HASH_STOP and 0 < i < (len(s)-1):
if char in HASH_STOP and i > 0:
break
hash ^= ((hash<<5)+(hash>>2)+ord(char))&0xFFFFFFFFFFFFFFFF