java.lang.Object
com.pervasive.datarush.util.HashMixer
A representation of a partially completed hash of a sequence of values. The internal state contains more bits than
the final 32-bit hash code.
This implementation is based on C code placed in the public domain by Bob Jenkins. It is advertised as strong enough to allow the
use of hash & mask instead of hash % prime for computing a hash bucket.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintfinalMix(int i, int j, int k) Performs the final "mix" of the internal state with the given parameters, resets the state, and returns the resulting hash code.voidmix(int i, int j, int k) Replicates the computation of Bob Jenkins' "mix" macro.
-
Constructor Details
-
HashMixer
public HashMixer()Constructs a mixer by initializing the internal state.
-
-
Method Details
-
mix
public void mix(int i, int j, int k) Replicates the computation of Bob Jenkins' "mix" macro.- Parameters:
i- the first input to the macroj- the second input to the macrok- the third input to the macro
-
finalMix
public int finalMix(int i, int j, int k) Performs the final "mix" of the internal state with the given parameters, resets the state, and returns the resulting hash code.- Parameters:
i- the first four bytes to includej- the second four bytes to includek- the final four bytes to include- Returns:
- the hash code produced by "mixing" initial state, parameters to each call of
mix(int, int, int), and parameters tofinalMix(int, int, int)
-