public void testHashing() { for (String stringToTest : INPUTS) { for (String algorithmToTest : ALGORITHMS.keySet()) { assertMessageDigestHashing(HashTestUtils.ascii(stringToTest), algorithmToTest); } } }
private static void assertChecksum(ImmutableSupplier<Checksum> supplier, String input) { byte[] bytes = HashTestUtils.ascii(input); Checksum checksum = supplier.get(); checksum.update(bytes, 0, bytes.length); long value = checksum.getValue(); String toString = "name"; HashFunction func = new ChecksumHashFunction(supplier, 32, toString); assertEquals(toString, func.toString()); assertEquals(value, func.hashBytes(bytes).padToLong()); }
private static void assertHash32( int expected, ImmutableSupplier<Checksum> supplier, String input) { byte[] bytes = HashTestUtils.ascii(input); String toString = "name"; HashFunction func = new ChecksumHashFunction(supplier, 32, toString); assertEquals(expected, func.hashBytes(bytes).asInt()); assertEquals(toString, func.toString()); } }
private static void assertHash(int seed, long expected1, long expected2, String stringInput) { HashCode expected = toHashCode(expected1, expected2); byte[] input = HashTestUtils.ascii(stringInput); assertEquals(expected, murmur3_128(seed).hashBytes(input)); assertEquals(expected, murmur3_128(seed).newHasher().putBytes(input).hash()); }
public void testHashing() throws Exception { for (String stringToTest : INPUTS) { for (Table.Cell<String, SecretKey, HashFunction> cell : ALGORITHMS.cellSet()) { String algorithm = cell.getRowKey(); SecretKey key = cell.getColumnKey(); HashFunction hashFunc = cell.getValue(); assertMacHashing(HashTestUtils.ascii(stringToTest), algorithm, key, hashFunc); } } }
public void testHashing() { for (String stringToTest : INPUTS) { for (String algorithmToTest : ALGORITHMS.keySet()) { assertMessageDigestHashing(HashTestUtils.ascii(stringToTest), algorithmToTest); } } }
private static void assertChecksum(Supplier<Checksum> supplier, String input) { byte[] bytes = HashTestUtils.ascii(input); Checksum checksum = supplier.get(); checksum.update(bytes, 0, bytes.length); long value = checksum.getValue(); String toString = "name"; HashFunction func = new ChecksumHashFunction(supplier, 32, toString); assertEquals(toString, func.toString()); assertEquals(value, func.hashBytes(bytes).padToLong()); }
private static void assertHash32(int expected, Supplier<Checksum> supplier, String input) { byte[] bytes = HashTestUtils.ascii(input); String toString = "name"; HashFunction func = new ChecksumHashFunction(supplier, 32, toString); assertEquals(expected, func.hashBytes(bytes).asInt()); assertEquals(toString, func.toString()); } }
private static void assertHash(int seed, long expected1, long expected2, String stringInput) { HashCode expected = toHashCode(expected1, expected2); byte[] input = HashTestUtils.ascii(stringInput); assertEquals(expected, murmur3_128(seed).hashBytes(input)); assertEquals(expected, murmur3_128(seed).newHasher().putBytes(input).hash()); }
public void testHashing() throws Exception { for (String stringToTest : INPUTS) { for (Table.Cell<String, SecretKey, HashFunction> cell : ALGORITHMS.cellSet()) { String algorithm = cell.getRowKey(); SecretKey key = cell.getColumnKey(); HashFunction hashFunc = cell.getValue(); assertMacHashing(HashTestUtils.ascii(stringToTest), algorithm, key, hashFunc); } } }