We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
trekhleb
Learn more about funding links in repositories.
Report abuse
1 parent 51f496c commit ff4854eCopy full SHA for ff4854e
src/algorithms/cryptography/polynomial-hash/PolynomialHash.js
@@ -25,8 +25,7 @@ export default class PolynomialHash {
25
let hash = 0;
26
for (let charIndex = 0; charIndex < charCodes.length; charIndex += 1) {
27
hash *= this.base;
28
- hash %= this.modulus;
29
- hash += charCodes[charIndex] % this.modulus;
+ hash += charCodes[charIndex];
30
hash %= this.modulus;
31
}
32
@@ -61,11 +60,9 @@ export default class PolynomialHash {
61
60
62
hash += this.modulus;
63
hash -= (prevValue * prevValueMultiplier) % this.modulus;
64
65
66
67
68
- hash += newValue % this.modulus;
+ hash += newValue;
69
70
71
return hash;
0 commit comments