MRI Ruby implementation of the jump consistent hash algorithm by John Lamping and Eric Veach of Google.
Add this line to your application's Gemfile:
gem "jumphash"
And then execute:
$ bundle
Or install it yourself as:
$ gem install jumphash
require "jumphash"
require "xxhash"
JumpHash.hash_key(314159265359, 256)
# => 80
JumpHash.hash_string("foobar", 256) { |str| XXhash.xxh64(str) }
# => 76
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.
The gem is available as open source under the terms of the MIT License.