NAME

new %PARAMS

Create a brand new instance. Allowable params are error_rate, min_length.

PUBLIC METHODS

add @EMAIL

Adds email addresses to the filter. You can either add email addresses directly, or add the output of a sha1_base64 hash.

check ARGS

Checks the provided arg list against the bloom filter, and returns a list of equivalent length, with true or false values depending on whether there was a match. Takes either email addresses or sha1_base64 hashes as args.

clear

Removes all addresses from the filter

build_filter

Builds a bloom filter and stores it internally

on_bits

Returns the number of 'on' bits in the bloom filter

get_salts

Returns the current list of salts

set_salts ARRAY

Sets the salts to be used with this filter

set_error_rate RATE

Sets the maximum false positive rate on the filter to RATE. RATE must be a number between 0 and 1.

INTERNAL METHODS

_make_bitmask

Given a key, hash it using the list of salts and return a bitmask the same length as the Bloom filter. Note that Perl will pad the bitmask out with zeroes so it's a muliple of 8.

_calculate_filter_length

Using the stored information for number of salts, number of items, and desired error rate, calculate how long to make the filter string to ensure the error rate stays within bounds.

AUTHOR

Maciej Ceglowski <maciej@ceglowski.com>

COPYRIGHT AND LICENSE

(c) 2004 Maciej Ceglowski, Joshua Schachter

This is free software, distributed under version 2 of the GNU Public License (GPL). See LICENSE for full text.