diff --git a/src/webui/www/private/scripts/client.js b/src/webui/www/private/scripts/client.js index a5216b6e2..a0b3e877d 100644 --- a/src/webui/www/private/scripts/client.js +++ b/src/webui/www/private/scripts/client.js @@ -88,11 +88,12 @@ const loadSelectedTracker = function() { loadSelectedTracker(); function genHash(string) { + // origins: + // https://stackoverflow.com/a/8831937 + // https://gist.github.com/hyamamoto/fd435505d29ebfa3d9716fd2be8d42f0 let hash = 0; - for (let i = 0; i < string.length; ++i) { - const c = string.charCodeAt(i); - hash = (c + hash * 31) | 0; - } + for (let i = 0; i < string.length; ++i) + hash = ((Math.imul(hash, 31) + string.charCodeAt(i)) | 0); return hash; }