···77from utils import parse_line, parse_nums, mul, all_unique, factors, memoize, primes, resolve_mapping
88from utils import chunks, parts, gcd, lcm, print_grid, min_max_xy
99from utils import new_table, transposed, rotated, firsts, lasts
1010-from utils import md5, sha256, VOWELS, CONSONANTS
1010+from utils import md5, sha256, VOWELS, CONSONANTS, HASH
1111from utils import Point, DIRS, DIRS_4, DIRS_8, N, NE, E, SE, S, SW, W, NW
1212# Itertools Functions:
1313# product('ABCD', repeat=2) AA AB AC AD BA BB BC BD CA CB CC CD DA DB DC DD
+7
2023/utils.py
···381381 s.update(msg)
382382 return s.hexdigest()
383383384384+def HASH(code):
385385+ val = 0
386386+ for c in code:
387387+ val += ord(c)
388388+ val *= 17
389389+ val %= 256
390390+ return val
384391385392def knot_hash(msg):
386393 lengths = [ord(x) for x in msg] + [17, 31, 73, 47, 23]