org.infinispan.util.hash
Class MurmurHash2

java.lang.Object
  extended by org.infinispan.util.hash.MurmurHash2

public class MurmurHash2
extends Object

An implementation of Austin Appleby's MurmurHash2.0 algorithm, as documented on his website.

This implementation is based on the slower, endian-neutral version of the algorithm as documented on the site, ported from Austin Appleby's original C++ version MurmurHashNeutral2.cpp.

Other implementations are documented on Wikipedia's MurmurHash page.

Version:
4.1
Author:
Manik Surtani
See Also:
http://en.wikipedia.org/wiki/MurmurHash}, http://sites.google.com/site/murmurhash/}

Constructor Summary
MurmurHash2()
           
 
Method Summary
static int hash(byte[] payload)
          Hashes a byte array efficiently.
static int hash(int hashcode)
          An incremental version of the hash function, that spreads a pre-calculated hash code, such as one derived from Object.hashCode().
static int hash(Object o)
          A helper that calculates the hashcode of an object, choosing the optimal mechanism of hash calculation after considering the type of the object (byte array, String or Object).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MurmurHash2

public MurmurHash2()
Method Detail

hash

public static final int hash(byte[] payload)
Hashes a byte array efficiently.

Parameters:
payload - a byte array to hash
Returns:
a hash code for the byte array

hash

public static final int hash(int hashcode)
An incremental version of the hash function, that spreads a pre-calculated hash code, such as one derived from Object.hashCode().

Parameters:
hashcode - an object's hashcode
Returns:
a spread and hashed version of the hashcode

hash

public static final int hash(Object o)
A helper that calculates the hashcode of an object, choosing the optimal mechanism of hash calculation after considering the type of the object (byte array, String or Object).

Parameters:
o - object to hash
Returns:
a hashcode

Google Analytics

Copyright © 2010 JBoss, a division of Red Hat. All Rights Reserved.