consecutive HASH_STOP chars at start shouldn't count as a stop
This commit is contained in:
parent
554f21a84c
commit
bd176240d6
1 changed files with 4 additions and 1 deletions
|
@ -46,8 +46,11 @@ HASH_COLORS = [consts.CYAN, consts.PURPLE, consts.GREEN, consts.ORANGE,
|
|||
consts.LIGHTGREEN, consts.BLUE]
|
||||
def hash_colorize(s: str):
|
||||
hash = 5381
|
||||
non_stop = False
|
||||
for i, char in enumerate(s):
|
||||
if char in HASH_STOP and i > 0:
|
||||
if not char in HASH_STOP:
|
||||
non_stop = True
|
||||
elif non_stop:
|
||||
break
|
||||
hash ^= ((hash<<5)+(hash>>2)+ord(char))&0xFFFFFFFFFFFFFFFF
|
||||
|
||||
|
|
Loading…
Reference in a new issue