fix: update the implementation of simple_hash.js and .ts (#1656)
This commit is contained in:
parent
35c1885b3e
commit
98cd3a8076
|
|
@ -31,7 +31,7 @@ function xorHash(key) {
|
||||||
for (const c of key) {
|
for (const c of key) {
|
||||||
hash ^= c.charCodeAt(0);
|
hash ^= c.charCodeAt(0);
|
||||||
}
|
}
|
||||||
return hash & MODULUS;
|
return hash % MODULUS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 旋转哈希 */
|
/* 旋转哈希 */
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ function xorHash(key: string): number {
|
||||||
for (const c of key) {
|
for (const c of key) {
|
||||||
hash ^= c.charCodeAt(0);
|
hash ^= c.charCodeAt(0);
|
||||||
}
|
}
|
||||||
return hash & MODULUS;
|
return hash % MODULUS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 旋转哈希 */
|
/* 旋转哈希 */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue