Tabnine Logo
FarmHashFingerprint64
Code IndexAdd Tabnine to your IDE (free)

How to use
FarmHashFingerprint64
in
com.google.common.hash

Best Java code snippets using com.google.common.hash.FarmHashFingerprint64 (Showing top 20 results out of 315)

origin: google/guava

@Override
public HashCode hashBytes(byte[] input, int off, int len) {
 checkPositionIndexes(off, off + len, input.length);
 return HashCode.fromLong(fingerprint(input, off, len));
}
origin: google/guava

@VisibleForTesting
static long fingerprint(byte[] bytes, int offset, int length) {
 if (length <= 32) {
  if (length <= 16) {
   return hashLength0to16(bytes, offset, length);
  } else {
   return hashLength17to32(bytes, offset, length);
  }
 } else if (length <= 64) {
  return hashLength33To64(bytes, offset, length);
 } else {
  return hashLength65Plus(bytes, offset, length);
 }
}
origin: google/guava

@SuppressWarnings("ConstantOverflow")
long y = seed * K1 + 113;
long z = shiftMix(y * K2 + 113) * K2;
long[] v = new long[2];
long[] w = new long[2];
 y += v[0] + load64(bytes, offset + 40);
 z = rotateRight(z + w[0], 33) * K1;
 weakHashLength32WithSeeds(bytes, offset, v[1] * K1, x + w[0], v);
 weakHashLength32WithSeeds(bytes, offset + 32, z + w[1], y + load64(bytes, offset + 16), w);
 long tmp = x;
 x = z;
y += v[0] * 9 + load64(bytes, offset + 40);
z = rotateRight(z + w[0], 33) * mul;
weakHashLength32WithSeeds(bytes, offset, v[1] * mul, x + w[0], v);
weakHashLength32WithSeeds(bytes, offset + 32, z + w[1], y + load64(bytes, offset + 16), w);
return hashLength16(
  hashLength16(v[0], w[0], mul) + shiftMix(y) * K0 + x,
  hashLength16(v[1], w[1], mul) + z,
  mul);
origin: google/guava

private static long hashLength0to16(byte[] bytes, int offset, int length) {
 if (length >= 8) {
  long mul = K2 + length * 2;
  long a = load64(bytes, offset) + K2;
  long b = load64(bytes, offset + length - 8);
  long c = rotateRight(b, 37) * mul + a;
  long d = (rotateRight(a, 25) + b) * mul;
  return hashLength16(c, d, mul);
 }
 if (length >= 4) {
  long mul = K2 + length * 2;
  long a = load32(bytes, offset) & 0xFFFFFFFFL;
  return hashLength16(length + (a << 3), load32(bytes, offset + length - 4) & 0xFFFFFFFFL, mul);
 }
 if (length > 0) {
  byte a = bytes[offset];
  byte b = bytes[offset + (length >> 1)];
  byte c = bytes[offset + (length - 1)];
  int y = (a & 0xFF) + ((b & 0xFF) << 8);
  int z = length + ((c & 0xFF) << 2);
  return shiftMix(y * K2 ^ z * K0) * K2;
 }
 return K2;
}
origin: google/guava

private static long hashLength17to32(byte[] bytes, int offset, int length) {
 long mul = K2 + length * 2;
 long a = load64(bytes, offset) * K1;
 long b = load64(bytes, offset + 8);
 long c = load64(bytes, offset + length - 8) * mul;
 long d = load64(bytes, offset + length - 16) * K2;
 return hashLength16(
   rotateRight(a + b, 43) + rotateRight(c, 30) + d, a + rotateRight(b + K2, 18) + c, mul);
}
origin: google/j2objc

private static long hashLength0to16(byte[] bytes, int offset, int length) {
 if (length >= 8) {
  long mul = K2 + length * 2;
  long a = load64(bytes, offset) + K2;
  long b = load64(bytes, offset + length - 8);
  long c = rotateRight(b, 37) * mul + a;
  long d = (rotateRight(a, 25) + b) * mul;
  return hashLength16(c, d, mul);
 }
 if (length >= 4) {
  long mul = K2 + length * 2;
  long a = load32(bytes, offset) & 0xFFFFFFFFL;
  return hashLength16(length + (a << 3), load32(bytes, offset + length - 4) & 0xFFFFFFFFL, mul);
 }
 if (length > 0) {
  byte a = bytes[offset];
  byte b = bytes[offset + (length >> 1)];
  byte c = bytes[offset + (length - 1)];
  int y = (a & 0xFF) + ((b & 0xFF) << 8);
  int z = length + ((c & 0xFF) << 2);
  return shiftMix(y * K2 ^ z * K0) * K2;
 }
 return K2;
}
origin: google/guava

private static long hashLength33To64(byte[] bytes, int offset, int length) {
 long mul = K2 + length * 2;
 long a = load64(bytes, offset) * K2;
 long b = load64(bytes, offset + 8);
 long c = load64(bytes, offset + length - 8) * mul;
 long d = load64(bytes, offset + length - 16) * K2;
 long y = rotateRight(a + b, 43) + rotateRight(c, 30) + d;
 long z = hashLength16(y, a + rotateRight(b + K2, 18) + c, mul);
 long e = load64(bytes, offset + 16) * mul;
 long f = load64(bytes, offset + 24);
 long g = (y + load64(bytes, offset + length - 32)) * mul;
 long h = (z + load64(bytes, offset + length - 24)) * mul;
 return hashLength16(
   rotateRight(e + f, 43) + rotateRight(g, 30) + h, e + rotateRight(f + a, 18) + g, mul);
}
origin: google/j2objc

@VisibleForTesting
static long fingerprint(byte[] bytes, int offset, int length) {
 if (length <= 32) {
  if (length <= 16) {
   return hashLength0to16(bytes, offset, length);
  } else {
   return hashLength17to32(bytes, offset, length);
  }
 } else if (length <= 64) {
  return hashLength33To64(bytes, offset, length);
 } else {
  return hashLength65Plus(bytes, offset, length);
 }
}
origin: google/j2objc

@SuppressWarnings("ConstantOverflow")
long y = seed * K1 + 113;
long z = shiftMix(y * K2 + 113) * K2;
long[] v = new long[2];
long[] w = new long[2];
 y += v[0] + load64(bytes, offset + 40);
 z = rotateRight(z + w[0], 33) * K1;
 weakHashLength32WithSeeds(bytes, offset, v[1] * K1, x + w[0], v);
 weakHashLength32WithSeeds(bytes, offset + 32, z + w[1], y + load64(bytes, offset + 16), w);
 long tmp = x;
 x = z;
y += v[0] * 9 + load64(bytes, offset + 40);
z = rotateRight(z + w[0], 33) * mul;
weakHashLength32WithSeeds(bytes, offset, v[1] * mul, x + w[0], v);
weakHashLength32WithSeeds(bytes, offset + 32, z + w[1], y + load64(bytes, offset + 16), w);
return hashLength16(
  hashLength16(v[0], w[0], mul) + shiftMix(y) * K0 + x,
  hashLength16(v[1], w[1], mul) + z,
  mul);
origin: wildfly/wildfly

private static long hashLength0to16(byte[] bytes, int offset, int length) {
 if (length >= 8) {
  long mul = K2 + length * 2;
  long a = load64(bytes, offset) + K2;
  long b = load64(bytes, offset + length - 8);
  long c = rotateRight(b, 37) * mul + a;
  long d = (rotateRight(a, 25) + b) * mul;
  return hashLength16(c, d, mul);
 }
 if (length >= 4) {
  long mul = K2 + length * 2;
  long a = load32(bytes, offset) & 0xFFFFFFFFL;
  return hashLength16(length + (a << 3), load32(bytes, offset + length - 4) & 0xFFFFFFFFL, mul);
 }
 if (length > 0) {
  byte a = bytes[offset];
  byte b = bytes[offset + (length >> 1)];
  byte c = bytes[offset + (length - 1)];
  int y = (a & 0xFF) + ((b & 0xFF) << 8);
  int z = length + ((c & 0xFF) << 2);
  return shiftMix(y * K2 ^ z * K0) * K2;
 }
 return K2;
}
origin: google/j2objc

private static long hashLength17to32(byte[] bytes, int offset, int length) {
 long mul = K2 + length * 2;
 long a = load64(bytes, offset) * K1;
 long b = load64(bytes, offset + 8);
 long c = load64(bytes, offset + length - 8) * mul;
 long d = load64(bytes, offset + length - 16) * K2;
 return hashLength16(
   rotateRight(a + b, 43) + rotateRight(c, 30) + d, a + rotateRight(b + K2, 18) + c, mul);
}
origin: google/j2objc

@Override
public HashCode hashBytes(byte[] input, int off, int len) {
 checkPositionIndexes(off, off + len, input.length);
 return HashCode.fromLong(fingerprint(input, off, len));
}
origin: wildfly/wildfly

@VisibleForTesting
static long fingerprint(byte[] bytes, int offset, int length) {
 if (length <= 32) {
  if (length <= 16) {
   return hashLength0to16(bytes, offset, length);
  } else {
   return hashLength17to32(bytes, offset, length);
  }
 } else if (length <= 64) {
  return hashLength33To64(bytes, offset, length);
 } else {
  return hashLength65Plus(bytes, offset, length);
 }
}
origin: wildfly/wildfly

@SuppressWarnings("ConstantOverflow")
long y = seed * K1 + 113;
long z = shiftMix(y * K2 + 113) * K2;
long[] v = new long[2];
long[] w = new long[2];
 y += v[0] + load64(bytes, offset + 40);
 z = rotateRight(z + w[0], 33) * K1;
 weakHashLength32WithSeeds(bytes, offset, v[1] * K1, x + w[0], v);
 weakHashLength32WithSeeds(bytes, offset + 32, z + w[1], y + load64(bytes, offset + 16), w);
 long tmp = x;
 x = z;
y += v[0] * 9 + load64(bytes, offset + 40);
z = rotateRight(z + w[0], 33) * mul;
weakHashLength32WithSeeds(bytes, offset, v[1] * mul, x + w[0], v);
weakHashLength32WithSeeds(bytes, offset + 32, z + w[1], y + load64(bytes, offset + 16), w);
return hashLength16(
  hashLength16(v[0], w[0], mul) + shiftMix(y) * K0 + x,
  hashLength16(v[1], w[1], mul) + z,
  mul);
origin: org.jboss.eap/wildfly-client-all

private static long hashLength0to16(byte[] bytes, int offset, int length) {
 if (length >= 8) {
  long mul = K2 + length * 2;
  long a = load64(bytes, offset) + K2;
  long b = load64(bytes, offset + length - 8);
  long c = rotateRight(b, 37) * mul + a;
  long d = (rotateRight(a, 25) + b) * mul;
  return hashLength16(c, d, mul);
 }
 if (length >= 4) {
  long mul = K2 + length * 2;
  long a = load32(bytes, offset) & 0xFFFFFFFFL;
  return hashLength16(length + (a << 3), load32(bytes, offset + length - 4) & 0xFFFFFFFFL, mul);
 }
 if (length > 0) {
  byte a = bytes[offset];
  byte b = bytes[offset + (length >> 1)];
  byte c = bytes[offset + (length - 1)];
  int y = (a & 0xFF) + ((b & 0xFF) << 8);
  int z = length + ((c & 0xFF) << 2);
  return shiftMix(y * K2 ^ z * K0) * K2;
 }
 return K2;
}
origin: wildfly/wildfly

private static long hashLength17to32(byte[] bytes, int offset, int length) {
 long mul = K2 + length * 2;
 long a = load64(bytes, offset) * K1;
 long b = load64(bytes, offset + 8);
 long c = load64(bytes, offset + length - 8) * mul;
 long d = load64(bytes, offset + length - 16) * K2;
 return hashLength16(
   rotateRight(a + b, 43) + rotateRight(c, 30) + d, a + rotateRight(b + K2, 18) + c, mul);
}
origin: wildfly/wildfly

@Override
public HashCode hashBytes(byte[] input, int off, int len) {
 checkPositionIndexes(off, off + len, input.length);
 return HashCode.fromLong(fingerprint(input, off, len));
}
origin: org.jboss.eap/wildfly-client-all

@VisibleForTesting
static long fingerprint(byte[] bytes, int offset, int length) {
 if (length <= 32) {
  if (length <= 16) {
   return hashLength0to16(bytes, offset, length);
  } else {
   return hashLength17to32(bytes, offset, length);
  }
 } else if (length <= 64) {
  return hashLength33To64(bytes, offset, length);
 } else {
  return hashLength65Plus(bytes, offset, length);
 }
}
origin: org.kill-bill.billing/killbill-platform-osgi-bundles-logger

@SuppressWarnings("ConstantOverflow")
long y = seed * K1 + 113;
long z = shiftMix(y * K2 + 113) * K2;
long[] v = new long[2];
long[] w = new long[2];
 y += v[0] + load64(bytes, offset + 40);
 z = rotateRight(z + w[0], 33) * K1;
 weakHashLength32WithSeeds(bytes, offset, v[1] * K1, x + w[0], v);
 weakHashLength32WithSeeds(bytes, offset + 32, z + w[1], y + load64(bytes, offset + 16), w);
 long tmp = x;
 x = z;
y += v[0] * 9 + load64(bytes, offset + 40);
z = rotateRight(z + w[0], 33) * mul;
weakHashLength32WithSeeds(bytes, offset, v[1] * mul, x + w[0], v);
weakHashLength32WithSeeds(bytes, offset + 32, z + w[1], y + load64(bytes, offset + 16), w);
return hashLength16(
  hashLength16(v[0], w[0], mul) + shiftMix(y) * K0 + x,
  hashLength16(v[1], w[1], mul) + z,
  mul);
origin: org.kill-bill.billing/killbill-platform-osgi-bundles-logger

private static long hashLength0to16(byte[] bytes, int offset, int length) {
 if (length >= 8) {
  long mul = K2 + length * 2;
  long a = load64(bytes, offset) + K2;
  long b = load64(bytes, offset + length - 8);
  long c = rotateRight(b, 37) * mul + a;
  long d = (rotateRight(a, 25) + b) * mul;
  return hashLength16(c, d, mul);
 }
 if (length >= 4) {
  long mul = K2 + length * 2;
  long a = load32(bytes, offset) & 0xFFFFFFFFL;
  return hashLength16(length + (a << 3), load32(bytes, offset + length - 4) & 0xFFFFFFFFL, mul);
 }
 if (length > 0) {
  byte a = bytes[offset];
  byte b = bytes[offset + (length >> 1)];
  byte c = bytes[offset + (length - 1)];
  int y = (a & 0xFF) + ((b & 0xFF) << 8);
  int z = length + ((c & 0xFF) << 2);
  return shiftMix(y * K2 ^ z * K0) * K2;
 }
 return K2;
}
com.google.common.hashFarmHashFingerprint64

Javadoc

Implementation of FarmHash Fingerprint64, an open-source fingerprinting algorithm for strings.

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:

  • comparisons (signed values can be negative)
  • division (avoided here)
  • shifting (right shift must be unsigned)

Most used methods

  • fingerprint
  • hashLength0to16
  • hashLength16
  • hashLength17to32
  • hashLength33To64
  • hashLength65Plus
  • shiftMix
  • weakHashLength32WithSeeds
    Computes intermediate hash of 32 bytes of byte array from the given offset. Results are returned in

Popular in Java

  • Updating database using SQL prepared statement
  • startActivity (Activity)
  • compareTo (BigDecimal)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now