Example usage for com.google.common.hash Hashing murmur3_128

List of usage examples for com.google.common.hash Hashing murmur3_128

Introduction

In this page you can find the example usage for com.google.common.hash Hashing murmur3_128.

Prototype

public static HashFunction murmur3_128(int seed) 

Source Link

Document

Returns a hash function implementing the <a href="http://smhasher.googlecode.com/svn/trunk/MurmurHash3.cpp"> 128-bit murmur3 algorithm, x64 variant</a> (little-endian variant), using the given seed value.

Usage

From source file:io.pravega.common.hash.HashHelper.java

private HashHelper(int seed) {
    hash = Hashing.murmur3_128(seed);
}

From source file:com.ebay.jetstream.messaging.transport.netty.schedulingalgorithm.consistenthashing.MurmurHashFunction.java

public void setSeed(int seed) {
    this.m_seed = seed;
    m_hf = Hashing.murmur3_128(m_seed);
}

From source file:com.ebay.jetstream.messaging.transport.netty.schedulingalgorithm.consistenthashing.MurmurHashFunction.java

public MurmurHashFunction() {
    m_hf = Hashing.murmur3_128(m_seed);
}

From source file:edu.umd.marbl.mhap.sketch.HashUtils.java

public static long[] computeHashes(String item, int numWords, int seed) {
    long[] hashes = new long[numWords];

    for (int word = 0; word < numWords; word += 2) {
        HashFunction hashFunc = Hashing.murmur3_128(seed + word);
        Hasher hasher = hashFunc.newHasher();
        hasher.putUnencodedChars(item);/*from   w w  w  . j  a  va2s  .c  om*/

        // get the two longs out
        HashCode hc = hasher.hash();
        ByteBuffer bb = ByteBuffer.wrap(hc.asBytes());
        hashes[word] = bb.getLong(0);
        if (word + 1 < numWords)
            hashes[word + 1] = bb.getLong(8);
    }

    return hashes;
}

From source file:com.necla.simba.util.ConsistentHash.java

public int hash(String token, int size) {
    return Hashing.consistentHash(Hashing.murmur3_128(SEED).hashString(token), size);
}

From source file:com.facebook.presto.hdfs.function.Function0.java

@JsonCreator
public Function0(@JsonProperty("seed") int seed, @JsonProperty("fiberNum") int fiberNum) {
    this.seed = seed;
    this.fiberNum = fiberNum;
    this.hasher = Hashing.murmur3_128(seed);
}

From source file:com.necla.simba.util.ConsistentHash.java

public int hash(int token, int size) {
    return Hashing.consistentHash(Hashing.murmur3_128(SEED).hashInt(token), size);
}

From source file:com.necla.simba.util.ConsistentHash.java

public String getNode(String id) {
    int bucket = Hashing.consistentHash(Hashing.murmur3_128(SEED).hashString(id), servers.size());
    return servers.get(bucket);
}

From source file:poke.server.hash.MurmurHash128.java

public Long hash(String value) {
    HashFunction hf = Hashing.murmur3_128(seed);
    HashCode hc = hf.newHasher().putString(value, Charsets.UTF_8).hash();
    return new Long(hc.asLong());
}

From source file:org.breizhbeans.thrift.tools.thriftmongobridge.example.SecuredWrapper.java

@Override
public long digest64(byte[] data) {
    // initialize the hash with the AES Hash code
    int seed = Arrays.hashCode(skeyspec.getEncoded());
    HashFunction hf = Hashing.murmur3_128(seed);

    com.google.common.hash.HashCode hashCode = hf.hashBytes(data);

    return hashCode.padToLong();
}