List of usage examples for com.google.common.hash Hashing murmur3_128
public static HashFunction murmur3_128()
From source file:org.metastatic.rsync.Murmur3Adapter.java
public Murmur3Adapter() { hashFunction = Hashing.murmur3_128(); hasher = hashFunction.newHasher(); }
From source file:it.unibo.alchemist.model.implementations.molecules.SimpleMolecule.java
private void initHash() { if (hash == null) { final HashCode hashCode = Hashing.murmur3_128().hashString(n, StandardCharsets.UTF_8); hash32 = hashCode.asInt();/*from ww w .j a v a 2 s . co m*/ hash64 = hashCode.asLong(); hash = hashCode.asBytes(); } }
From source file:org.fenixedu.cms.domain.CMSThemeFiles.java
private String computeChecksum() { StringBuilder builder = new StringBuilder(); this.files.values().forEach(file -> { builder.append(Hashing.sha256().hashBytes(file.getContent()).toString()); });/*w w w . j a va 2s . c o m*/ return Hashing.murmur3_128().hashString(builder, StandardCharsets.UTF_8).toString().substring(0, 16); }
From source file:io.druid.embedded.jackson.MissingAggregatorsModule.java
public MissingAggregatorsModule() { super("AggregatorFactories"); if (ComplexMetrics.getSerdeForType("hyperUnique") == null) { ComplexMetrics.registerSerde("hyperUnique", new HyperUniquesSerde(Hashing.murmur3_128())); }/*from w w w .j a va 2 s . c o m*/ setMixInAnnotation(AggregatorFactory.class, AggregatorFactoryMixin.class); setMixInAnnotation(PostAggregator.class, PostAggregatorMixin.class); }
From source file:com.github.benmanes.caffeine.cache.simulator.parser.wikipedia.WikipediaTraceReader.java
@Override public LongStream events() throws IOException { return lines().map(this::parseRequest).filter(Objects::nonNull) .mapToLong(path -> Hashing.murmur3_128().hashString(path, StandardCharsets.UTF_8).asLong()); }
From source file:com.github.fhuss.storm.cassandra.Murmur3StreamGrouping.java
/** * Computes the murmur3 hash for the specified values. * http://stackoverflow.com/questions/27212797/cassandra-hashing-algorithm-with-composite-keys * https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/db/marshal/CompositeType.java * * @param values the fields which are part of the (compose) partition key. * @return the computed hash for input values. * @throws IOException/*from w ww . j a v a 2s. co m*/ */ @VisibleForTesting public static long hashes(List<Object> values) throws IOException { byte[] keyBytes; try (ByteArrayOutputStream bos = new ByteArrayOutputStream(); DataOutputStream out = new DataOutputStream(bos)) { for (Object key : values) { byte[] arr = ((String) key).getBytes("UTF-8"); out.writeShort(arr.length); out.write(arr, 0, arr.length); out.writeByte(0); } out.flush(); keyBytes = bos.toByteArray(); } return Hashing.murmur3_128().hashBytes(keyBytes).asLong(); }
From source file:org.apache.kylin.measure.hllc.HLLCounter.java
public HLLCounter(int p, RegisterType type) { this(p, type, Hashing.murmur3_128()); }
From source file:com.palantir.atlasdb.table.description.render.Renderer.java
protected byte[] getHash() { return Hashing.murmur3_128().hashUnencodedChars(s).asBytes(); }
From source file:org.apache.beam.sdk.io.common.HashingFn.java
@Override public Accum addInput(Accum accum, String input) { List<HashCode> elementHashes = Lists.newArrayList(); if (accum.hashCode != null) { elementHashes.add(accum.hashCode); }//from w w w .ja va 2 s.c o m HashCode inputHashCode = Hashing.murmur3_128().hashString(input, StandardCharsets.UTF_8); elementHashes.add(inputHashCode); accum.hashCode = Hashing.combineUnordered(elementHashes); return accum; }
From source file:benchmarks.Benchmark128BitHash.java
@Benchmark public void guava_murmur3_128(Blackhole bh, BenchmarkData bd, ByteCounter bc) { byte[] bytes = bd.getBytes(); bc.add(bytes.length);//from w ww . j ava 2s. co m bh.consume(Hashing.murmur3_128().hashBytes(bytes).asBytes()); }