final class FarmHashFingerprint64 extends AbstractNonStreamingHashFunction
Its speed is comparable to CityHash64, and its quality of hashing is at least as good.
Note to maintainers: This implementation relies on signed arithmetic being bit-wise equivalent to unsigned arithmetic in all cases except:
Modifier and Type | Field and Description |
---|---|
private static long |
K0 |
private static long |
K1 |
private static long |
K2 |
Constructor and Description |
---|
FarmHashFingerprint64() |
Modifier and Type | Method and Description |
---|---|
int |
bits()
Returns the number of bits (a multiple of 32) that each hash code produced by this hash
function has.
|
(package private) static long |
fingerprint(byte[] bytes,
int offset,
int length) |
HashCode |
hashBytes(byte[] input,
int off,
int len)
Shortcut for
newHasher().putBytes(input, off, len).hash() . |
private static long |
hashLength0to16(byte[] bytes,
int offset,
int length) |
private static long |
hashLength16(long u,
long v,
long mul) |
private static long |
hashLength17to32(byte[] bytes,
int offset,
int length) |
private static long |
hashLength33To64(byte[] bytes,
int offset,
int length) |
private static long |
hashLength65Plus(byte[] bytes,
int offset,
int length) |
private static long |
shiftMix(long val) |
java.lang.String |
toString() |
private static void |
weakHashLength32WithSeeds(byte[] bytes,
int offset,
long seedA,
long seedB,
long[] output)
Computes intermediate hash of 32 bytes of byte array from the given offset.
|
hashBytes, hashInt, hashLong, hashObject, hashString, hashUnencodedChars, newHasher, newHasher
private static final long K0
private static final long K1
private static final long K2
public HashCode hashBytes(byte[] input, int off, int len)
HashFunction
newHasher().putBytes(input, off, len).hash()
. The implementation
might perform better than its longhand equivalent, but should not perform worse.public int bits()
HashFunction
public java.lang.String toString()
toString
in class java.lang.Object
static long fingerprint(byte[] bytes, int offset, int length)
private static long shiftMix(long val)
private static long hashLength16(long u, long v, long mul)
private static void weakHashLength32WithSeeds(byte[] bytes, int offset, long seedA, long seedB, long[] output)
private static long hashLength0to16(byte[] bytes, int offset, int length)
private static long hashLength17to32(byte[] bytes, int offset, int length)
private static long hashLength33To64(byte[] bytes, int offset, int length)
private static long hashLength65Plus(byte[] bytes, int offset, int length)