Closed aprescott closed 13 years ago
The subtraction should be firstCharCodeValue * Math.pow(base, lastPower), instead of firstCharCodeValue * lastPower.
Just to clarify, this makes hash("ab"); nextHash("c"); come out the same as hash("bc");, as desired.
hash("ab"); nextHash("c");
hash("bc");
I clearly didn't read closely enough, as lastPower is in fact the computed value. Sorry for the noise.
lastPower
The subtraction should be firstCharCodeValue * Math.pow(base, lastPower), instead of firstCharCodeValue * lastPower.