public void testSipHash24() { HashTestUtils.check2BitAvalanche(Hashing.sipHash24(), 250, 0.14); HashTestUtils.checkAvalanche(Hashing.sipHash24(), 250, 0.10); HashTestUtils.checkNo2BitCharacteristics(Hashing.sipHash24()); HashTestUtils.checkNoFunnels(Hashing.sipHash24()); HashTestUtils.assertInvariants(Hashing.sipHash24()); assertEquals( "Hashing.sipHash24(506097522914230528, 1084818905618843912)", Hashing.sipHash24().toString()); }
public void test15ByteStringFromSipHashPaper() { byte[] message = new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e }; long k0 = 0x0706050403020100L; long k1 = 0x0f0e0d0c0b0a0908L; assertEquals(0xa129ca6149be45e5L, Hashing.sipHash24(k0, k1).hashBytes(message).asLong()); }
public void testToString() { assertEquals("Hashing.sipHash24(" + K0 + ", " + K1 + ")", SIP_WITH_KEY.toString()); assertEquals("Hashing.sipHash24(" + K0 + ", " + K1 + ")", SIP_WITHOUT_KEY.toString()); assertEquals("Hashing.sipHash24(20, 13)", Hashing.sipHash24(20, 13).toString()); }
hf = Hashing.sipHash24(); break;
@Override public URI buildRepoURI(URI rootRepoURI, String repoName) { final File rootDirectory = toFile(rootRepoURI); // Look up repo ID for repo name, if it does not exist, generate a new one String repoId = reposUnderRootDirectory(rootDirectory).get(repoName); if (repoId == null) { SecureRandom rnd = new SecureRandom(); byte[] bytes = new byte[128]; rnd.nextBytes(bytes); repoId = Hashing.sipHash24().hashBytes(bytes).toString(); } File repoDirectory = new File(rootDirectory, repoId); return repoDirectory.toURI(); }
@Override public URI buildRepoURI(URI rootRepoURI, String repoName) { final File rootDirectory = toFile(rootRepoURI); // Look up repo ID for repo name, if it does not exist, generate a new one String repoId = reposUnderRootDirectory(rootDirectory).get(repoName); if (repoId == null) { SecureRandom rnd = new SecureRandom(); byte[] bytes = new byte[128]; rnd.nextBytes(bytes); repoId = Hashing.sipHash24().hashBytes(bytes).toString(); } File repoDirectory = new File(rootDirectory, repoId); return repoDirectory.toURI(); }
public void testSipHash24() { HashTestUtils.check2BitAvalanche(Hashing.sipHash24(), 250, 0.14); HashTestUtils.checkAvalanche(Hashing.sipHash24(), 250, 0.10); HashTestUtils.checkNo2BitCharacteristics(Hashing.sipHash24()); HashTestUtils.checkNoFunnels(Hashing.sipHash24()); HashTestUtils.assertInvariants(Hashing.sipHash24()); assertEquals("Hashing.sipHash24(506097522914230528, 1084818905618843912)", Hashing.sipHash24().toString()); }
public void test15ByteStringFromSipHashPaper() { byte[] message = new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e }; long k0 = 0x0706050403020100L; long k1 = 0x0f0e0d0c0b0a0908L; assertEquals(0xa129ca6149be45e5L, Hashing.sipHash24(k0, k1).hashBytes(message).asLong()); }
byte[] bytes = new byte[128]; rnd.nextBytes(bytes); String deleteToken = Hashing.sipHash24().hashBytes(bytes).toString();
public void testToString() { assertEquals("Hashing.sipHash24(" + K0 + ", " + K1 + ")", SIP_WITH_KEY.toString()); assertEquals("Hashing.sipHash24(" + K0 + ", " + K1 + ")", SIP_WITHOUT_KEY.toString()); assertEquals("Hashing.sipHash24(20, 13)", Hashing.sipHash24(20, 13).toString()); }