forked from gxed/bbloom
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathdoc.go
More file actions
18 lines (18 loc) · 919 Bytes
/
doc.go
File metadata and controls
18 lines (18 loc) · 919 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Package bbloom implements a fast bloom filter with a real bitset.
//
// A Bloom filter is a space-efficient probabilistic data structure used to
// test set membership. It may return false positives but never false negatives:
// [Bloom.Has] returning true means the entry was probably added, while false
// means the entry was definitely not added.
//
// This implementation uses an inlined SipHash-2-4 for hashing, rounds the
// bitset up to the next power of two for fast masking, and provides both
// non-thread-safe and mutex-protected (TS-suffixed) variants of all operations.
//
// By default ([New]) the filter uses publicly known SipHash keys. When the
// filter will hold data controlled by untrusted parties, use [NewWithKeys]
// with random secret keys to prevent hash-flooding attacks.
//
// Filters can be serialized to JSON with [Bloom.JSONMarshal] and restored
// with [JSONUnmarshal].
package bbloom