Search in sources :

Example 1 with MD5Cyclic

use of org.apache.commons.collections4.bloomfilter.hasher.function.MD5Cyclic in project commons-collections by apache.

the class HasherBloomFilterTest method constructorTest_NonStatic.

/**
 * Tests that the constructor works correctly.
 */
@Test
public void constructorTest_NonStatic() {
    final Shape shape = new Shape(new MD5Cyclic(), 3, 72, 17);
    final DynamicHasher hasher = new DynamicHasher.Builder(new MD5Cyclic()).with("Hello", StandardCharsets.UTF_8).build();
    final HasherBloomFilter filter = createFilter(hasher, shape);
    final long[] lb = filter.getBits();
    assertEquals(2, lb.length);
    assertEquals(0x6203101001888c44L, lb[0]);
    assertEquals(0x60L, lb[1]);
}
Also used : Shape(org.apache.commons.collections4.bloomfilter.hasher.Shape) DynamicHasher(org.apache.commons.collections4.bloomfilter.hasher.DynamicHasher) MD5Cyclic(org.apache.commons.collections4.bloomfilter.hasher.function.MD5Cyclic) Test(org.junit.jupiter.api.Test)

Aggregations

DynamicHasher (org.apache.commons.collections4.bloomfilter.hasher.DynamicHasher)1 Shape (org.apache.commons.collections4.bloomfilter.hasher.Shape)1 MD5Cyclic (org.apache.commons.collections4.bloomfilter.hasher.function.MD5Cyclic)1 Test (org.junit.jupiter.api.Test)1