Jumphash

Build Status

MRI Ruby implementation of the jump consistent hash algorithm by John Lamping and Eric Veach of Google.

Installation

Add this line to your application's Gemfile:

gem "jumphash"

And then execute:

$ bundle

Or install it yourself as:

$ gem install jumphash

Usage

require "jumphash"
require "xxhash"

JumpHash.hash_key(314159265359, 256)
# => 80

JumpHash.hash_string("foobar", 256) { |str| XXhash.xxh64(str) }
# => 76

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/cdolan/jumphash. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.