named-port
v4.0.1
Published
Deterministically map service names to port numbers
Downloads
126
Readme
named-port
Deterministically map service names to port numbers (1024,65535).
Usage
$ npx named-port Filecoin Station Core
51806import namedPort from 'named-port'
console.log(namedPort('Filecoin Station Core'))Custom port range
console.log(namedPort('Filecoin Station Core', { min: 3000, max: 10000 }))Algorithm
port = min + H(name) % (max - min + 1)H(name):hash = 0; for each char c: hash = (hash * 31 + c.charCodeAt(0)) >>> 031: prime multiplier for even distribution>>> 0: 32-bit unsigned overflow handling
