https://github.com/benbjohnson/jmphash
Implementation of the Jump Consistent Hash algorithm in Go.
https://github.com/benbjohnson/jmphash
Last synced: 9 months ago
JSON representation
Implementation of the Jump Consistent Hash algorithm in Go.
- Host: GitHub
- URL: https://github.com/benbjohnson/jmphash
- Owner: benbjohnson
- License: mit
- Created: 2014-06-23T21:35:30.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2014-12-16T15:46:55.000Z (about 11 years ago)
- Last Synced: 2025-03-31T09:06:55.564Z (9 months ago)
- Language: Go
- Size: 152 KB
- Stars: 153
- Watchers: 5
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
jmphash
=======
Implementation of the [Jump Consistent Hash algorithm](http://arxiv.org/pdf/1406.2294v1.pdf) in Go.
This algorithm performs consistent hashing on integer keys and maps them
to integer buckets.
## Usage
To use jmphash, simply create a `Hasher` with the number of buckets you want
to map to and then call the `Hash()` function with your key. This function
will return the bucket that your key is mapped to.
```go
import "github.com/benbjohnson/jmphash"
func main() {
// Create a hash with 100 buckets.
h := jmphash.NewHasher(100)
// Map keys to their appropriate buckets.
bucket := h.Hash(12387)
}
```