Skip to content

Commit 8d77c80

Browse files
committed
Updated hashing functions.
1 parent c25cce7 commit 8d77c80

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

hashes/hash-test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,15 @@ def polyhash_prime(word, a, p, m):
8282
for c in word:
8383
hash = (hash * a + ord(c)) % p
8484

85-
return hash % m
85+
return abs(hash % m)
8686

8787

8888
def polyhash_noprime(word, a, m):
8989
hash = 0
9090
for c in word:
9191
hash = (hash * a + ord(c))
9292

93-
return hash % m
93+
return abs(hash % m)
9494

9595

9696

0 commit comments

Comments
 (0)