We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7ef2646 commit 78d6eb4Copy full SHA for 78d6eb4
scripts/get-ports.js
@@ -48,7 +48,7 @@ const PORT_BASE = 100;
48
*/
49
function hashToPort(str) {
50
const hash = crypto.createHash('sha256').update(str).digest('hex');
51
- // Take first 8 hex chars and convert to decimal, then mod PORT_RANGE + PORT_BASE to get range [PORT_BASE, PORT_BASE + PORT_RANGE - 1]
+ // Take first 8 hex chars and convert to decimal, then take (num % PORT_RANGE) + PORT_BASE to get range [PORT_BASE, PORT_BASE + PORT_RANGE - 1]
52
// This ensures we skip the first PORT_BASE ports to avoid conflicts with common services
53
const num = parseInt(hash.substring(0, 8), 16);
54
return (num % PORT_RANGE) + PORT_BASE;
0 commit comments