From f95df6d0b20ad7f8362c18ff0ca4f64ce508794b Mon Sep 17 00:00:00 2001 From: Nathan Bean Date: Mon, 26 Aug 2024 14:11:46 -0500 Subject: [PATCH] Fixed negative bit issue in WID generation --- src/app.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/app.js b/src/app.js index 6ef0baf..7e6011e 100644 --- a/src/app.js +++ b/src/app.js @@ -75,6 +75,8 @@ app.get('/serviceValidate', (req, res) => { hash = ((hash << 5) - hash) + username.charCodeAt(i); hash |= 0; // to 32bit integer } + // Hash may be negative, if so, set to positive + if(hash < 0) hash = -hash // WIDs are 9 digits, and start with an 8 var wid = parseInt(hash.toString().slice(0,8), 10) + 800000000; res.send(