Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mafintosh/hash-to-port
Hash a value to a valid port
https://github.com/mafintosh/hash-to-port
Last synced: 17 days ago
JSON representation
Hash a value to a valid port
- Host: GitHub
- URL: https://github.com/mafintosh/hash-to-port
- Owner: mafintosh
- License: mit
- Created: 2015-10-08T15:13:49.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2020-11-29T11:47:23.000Z (almost 4 years ago)
- Last Synced: 2024-04-14T16:08:52.294Z (7 months ago)
- Language: JavaScript
- Homepage:
- Size: 5.86 KB
- Stars: 34
- Watchers: 5
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-network-js - hash-to-port
README
# hash-to-port
Hash a value to a valid port
```
npm install hash-to-port
```[![build status](http://img.shields.io/travis/mafintosh/hash-to-port.svg?style=flat)](http://travis-ci.org/mafintosh/hash-to-port)
## Usage
``` js
var toPort = require('hash-to-port')console.log(toPort('example.com')) // returns 22019
```## API
#### `var port = toPort(value, ?from, ?to)`
Hash the given value to a valid port (`>= from <= to`).
The same value will *always* hash to the same port but note that two different values might hash to the same port as well- `value`
- `from` (default: `1024`)
- `to` (default: `65535`)## License
MIT