This is an old version, saved 5 Dec 2026, 07:26 by TechWritereditor. See the current version.
Bloom filter
The Bloom filter is a data structure that uses a probabilistic method to test quickly whether an item is a member of a large set, using several hash functions to map items into a single array of bits.[3] It saves memory by accepting that a few answers will be wrong in one direction only.[1]
History
Burton H. Bloom, then of the Computer Usage Company in Newton Upper Falls, Massachusetts, described the idea in the paper "Space/Time Trade-offs in Hash Coding with Allowable Errors", published in Communications of the ACM in July 1970 (volume 13, number 7).[2] The paper studied the trade-off between memory, rejection time and an allowable error rate, and showed that letting a few non-members be falsely identified as members allows a much smaller hash area without slowing down rejections.[1] Bloom's example was automatic hyphenation: simple rules could hyphenate about 90 per cent of English words, and a compact filter held in core memory could flag the remaining words that needed a slower dictionary lookup on disk.[2]
How it works
A Bloom filter consists of an array of m bits and k hash functions, each of which maps an item to a position in the array.[4] To add an item, the filter sets the bits at all k positions to 1. To check an item, it looks at the same positions: if any bit is 0, the item is definitely absent; if all are 1, the item is probably present.[4] Because other items may have set the same bits, the filter can give false positives but never false negatives.[4][5] Ordinary Bloom filters cannot delete items, since clearing bits could remove evidence of other items, and the false-positive rate rises as the filter fills beyond its intended capacity.[4][5] Designers therefore choose m and k from the expected number of items and the error rate they can tolerate.[4]
Uses
Bloom filters are typically used as a cheap first check before an expensive lookup, such as testing whether a file might exist on a system or whether a website might be malicious.[5] Other reported uses include databases, caching, bioinformatics and Bitcoin clients.[5] Because a filter shows whether a given item is present without practically revealing the whole set, it has also been suggested for secret sharing.[3]
See also
References
- ^ Space/Time Trade-offs in Hash Coding with Allowable Errors. Communications of the ACM. 1970-07-01. cacm.acm.org
- ^ Space/Time Trade-offs in Hash Coding with Allowable Errors (paper PDF). Princeton University (copy of the ACM paper). 1970-07-01. cs.princeton.edu
- ^ Bloom filter – Dictionary of Algorithms and Data Structures. National Institute of Standards and Technology. 2024-09-20. xlinux.nist.gov
- ^ Bloom Filters (CMSC 420 lecture notes). University of Maryland. math.umd.edu
- ^ Bloom Filters – Introduction. Apache Software Foundation. commons.apache.org