diff --git a/src/parse/utils/hash.ts b/src/parse/utils/hash.ts index 4c6f9f14fe..8bc550a5c0 100644 --- a/src/parse/utils/hash.ts +++ b/src/parse/utils/hash.ts @@ -3,6 +3,6 @@ export default function hash(str: string): number { let hash = 5381; let i = str.length; - while (i--) hash = ((hash << 5) + hash) ^ str.charCodeAt(i); + while (i--) hash = ((hash << 5) - hash) ^ str.charCodeAt(i); return hash >>> 0; } diff --git a/src/shared/transitions.js b/src/shared/transitions.js index df788bd888..4f3efb66de 100644 --- a/src/shared/transitions.js +++ b/src/shared/transitions.js @@ -27,7 +27,7 @@ export function hash(str) { var hash = 5381; var i = str.length; - while (i--) hash = ((hash << 5) + hash) ^ str.charCodeAt(i); + while (i--) hash = ((hash << 5) - hash) ^ str.charCodeAt(i); return hash >>> 0; }