Skip to content

Instantly share code, notes, and snippets.

@jpountz
Last active December 10, 2015 20:38
Show Gist options
  • Select an option

  • Save jpountz/4489297 to your computer and use it in GitHub Desktop.

Select an option

Save jpountz/4489297 to your computer and use it in GitHub Desktop.
xxhash block hashing
XXHashFactory factory = XXHashFactory.fastestInstance();
byte[] data = "12345345234572".getBytes("UTF-8");
XXHash32 hash32 = factory.hash32();
int seed = 0x9747b28c; // used to initialize the hash value, use whatever
// value you want, but always the same
int hash = hash32.hash(data, 0, data.length, seed);
System.out.println("Block hash: " + hash);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment