Skip to content

Bloom

A simple Bloom filter implementation originally from ethereumjs

Constructors

new Bloom()

new Bloom(bitvector?): Bloom

Represents a Bloom filter.

Parameters

bitvector?: Uint8Array

Returns

Bloom

Throws

If the byte size of the bitvector is not 256.

Source

packages/utils/src/Bloom.ts:21

Properties

bitvector

bitvector: Uint8Array

Source

packages/utils/src/Bloom.ts:15

Methods

add()

add(e): void

Adds an element to a bit vector of a 64 byte bloom filter.

Parameters

e: Uint8Array

The element to add

Returns

void

Throws

Source

packages/utils/src/Bloom.ts:35


check()

check(e): boolean

Checks if an element is in the bloom.

Parameters

e: Uint8Array

The element to check

Returns

boolean

Throws

Source

packages/utils/src/Bloom.ts:53


multiCheck()

multiCheck(topics): boolean

Checks if multiple topics are in a bloom.

Parameters

topics: Uint8Array[]

Returns

boolean

true if every topic is in the bloom

Throws

Source

packages/utils/src/Bloom.ts:78


or()

or(bloom): void

Bitwise or blooms together.

Parameters

bloom: Bloom

Returns

void

Throws

Source

packages/utils/src/Bloom.ts:86