/** * Murmur3 64-bit variant. This is essentially MSB 8 bytes of Murmur3 128-bit variant. * * @param data - input byte array * @return - hashcode */ public static long hash64(byte[] data) { return hash64(data, 0, data.length, DEFAULT_SEED); }
private static long hash2(byte[] bytes) { final int PRIME = 1366661; return Murmur3.hash64(bytes, 0, bytes.length, PRIME); } }
public boolean testBytes(byte[] val, int offset, int length) { long hash64 = val == null ? Murmur3.NULL_HASHCODE : Murmur3.hash64(val, offset, length); return testHash(hash64); }
/** * ByteBuffer based copy of {@link BloomKFilter#addBytes(byte[], int, int)} that adds a value to the ByteBuffer * in place. */ public static void addBytes(ByteBuffer buffer, byte[] val, int offset, int length) { long hash64 = val == null ? Murmur3.NULL_HASHCODE : Murmur3.hash64(val, offset, length); addHash(buffer, hash64); }
/** * ByteBuffer based copy of {@link BloomKFilter#addLong(long)} that adds a value to the ByteBuffer in place. */ public static void addLong(ByteBuffer buffer, long val) { addHash(buffer, Murmur3.hash64(val)); }
public void addBytes(byte[] val, int offset, int length) { // We use the trick mentioned in "Less Hashing, Same Performance: Building a Better Bloom Filter" // by Kirsch et.al. From abstract 'only two hash functions are necessary to effectively // implement a Bloom filter without any loss in the asymptotic false positive probability' // Lets split up 64-bit hashcode into two 32-bit hash codes and employ the technique mentioned // in the above paper long hash64 = val == null ? Murmur3.NULL_HASHCODE : Murmur3.hash64(val, offset, length); addHash(hash64); }
public void addLong(long val) { // puts long in little endian order addHash(Murmur3.hash64(val)); }
public boolean testLong(long val) { return testHash(Murmur3.hash64(val)); }
public void addBytes(byte[] val, int offset, int length) { // We use the trick mentioned in "Less Hashing, Same Performance: Building a Better Bloom Filter" // by Kirsch et.al. From abstract 'only two hash functions are necessary to effectively // implement a Bloom filter without any loss in the asymptotic false positive probability' // Lets split up 64-bit hashcode into two 32-bit hash codes and employ the technique mentioned // in the above paper long hash64 = val == null ? Murmur3.NULL_HASHCODE : Murmur3.hash64(val, offset, length); addHash(hash64); }
public boolean testBytes(byte[] val, int offset, int length) { long hash64 = val == null ? Murmur3.NULL_HASHCODE : Murmur3.hash64(val, offset, length); return testHash(hash64); }
public void addLong(long val) { // puts long in little endian order addHash(Murmur3.hash64(val)); }
public boolean testBytes(byte[] val, int offset, int length) { long hash64 = val == null ? Murmur3.NULL_HASHCODE : Murmur3.hash64(val, offset, length); return testHash(hash64); }
/** * Java's default charset will be used for strings. * @param val * - input string */ public void addString(String val) { add(Murmur3.hash64(val.getBytes())); }
public void addBytes(byte[] val, int offset, int length) { // We use the trick mentioned in "Less Hashing, Same Performance: Building a Better Bloom Filter" // by Kirsch et.al. From abstract 'only two hash functions are necessary to effectively // implement a Bloom filter without any loss in the asymptotic false positive probability' // Lets split up 64-bit hashcode into two 32-bit hash codes and employ the technique mentioned // in the above paper long hash64 = val == null ? Murmur3.NULL_HASHCODE : Murmur3.hash64(val, offset, length); addHash(hash64); }
public void addString(String val, Charset charset) { add(Murmur3.hash64(val.getBytes(charset))); }
public boolean testInt(int val) { return testHash(Murmur3.hash64(val)); }
public void addBytes(byte[] val) { add(Murmur3.hash64(val)); }
public void addInt(int val) { add(Murmur3.hash64(val)); }
public void addFloat(float val) { add(Murmur3.hash64(Float.floatToIntBits(val))); }
public void addDouble(double val) { add(Murmur3.hash64(Double.doubleToLongBits(val))); }