UNPKG

@meterio/devkit

Version:

Typescript library to aid DApp development on Meter network

32 lines (31 loc) 812 B
/// <reference types="node" /> /** * 2048 bits Bloom filter */ export declare class Bloom { /** number of hash functions */ static readonly MAX_K = 16; /** bit length */ static readonly BITS_LENGTH = 2048; /** estimate k(number of hash functions) according to item count */ static estimateK(itemCount: number): number; readonly bits: Buffer; readonly k: number; /** * new bloom filter instance * @param k number of hash functions * @param bits leave it out to construct an empty one */ constructor(k: number, bits?: Buffer); /** * add item * @param item */ add(item: Buffer): void; /** * test if an item contained. (false positive) * @param item */ test(item: Buffer): boolean; private distribute; }