Skip to content

Commit

Permalink
Fixed negative bit issue in WID generation
Browse files Browse the repository at this point in the history
  • Loading branch information
zombiepaladin committed Aug 26, 2024
1 parent 454b589 commit f95df6d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit f95df6d

Please sign in to comment.