Class: Kafka::Murmur2Hash
- Inherits:
-
Object
- Object
- Kafka::Murmur2Hash
- Defined in:
- lib/kafka/murmur2_hash.rb
Constant Summary collapse
- SEED =
[0x9747b28c].pack('L')
Instance Method Summary collapse
Instance Method Details
#hash(value) ⇒ Object
13 14 15 |
# File 'lib/kafka/murmur2_hash.rb', line 13 def hash(value) ::Digest::MurmurHash2.rawdigest(value, SEED) & 0x7fffffff end |
#load ⇒ Object
7 8 9 10 11 |
# File 'lib/kafka/murmur2_hash.rb', line 7 def load require 'digest/murmurhash' rescue LoadError raise LoadError, "using murmur2 hashing requires adding a dependency on the `digest-murmurhash` gem to your Gemfile." end |