FileSizeSHA1Type
pybloom.py12K51ad230731340af36a0144236ad8ba7c2042905eASCII Java program text
This software is Public Domain. To view a copy of the public domain dedication,
visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.

I ask and expect, but do not require, that you contribute any bug fixes and strongly 
related additional features back to me with the same license.
 
 
pybloom
index
/home/agl/pybloom/pybloom.py

Bloom filters in Python
# Adam Langley <agl@imperialviolet.org>

 
Modules
       
array
struct

 
Classes
       
__builtin__.object
Bloom
CountedBloom

 
class Bloom(__builtin__.object)
    Bloom filters provide a fast and compact way of checking set membership. They do this by introducing a risk of a 
false positive (but there are no false negatives).
 
For more information see http://www.cs.wisc.edu/~cao/papers/summary-cache/node8.html
 
  Methods defined here:
__contains__(self, val)
__init__(self, bytes, hashes)
@bytes is the size of the bloom filter in 8-bit bytes and @hashes is the number of hash functions to use. Consult the
web page linked above for values to use. If in doubt, bytes = num_elements and hashes = 4
insert(self, val)

Data and other attributes defined here:
__dict__ = <dictproxy object>
dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'Bloom' objects>
list of weak references to the object (if defined)
bitmask = [128, 64, 32, 16, 8, 4, 2, 1]

 
class CountedBloom(Bloom)
    Just like a Bloom filter, but provides counting (e.g. you can delete as well). This uses 4 bits per bucket, so is
generally four times larger than the same non-counted bloom filter.
 
 
Method resolution order:
CountedBloom
Bloom
__builtin__.object

Methods defined here:
__contains__(self, val)
__delitem__(self, val)
__init__(self, buckets, hashes)
Please note that @buckets must be even. Also note that with a Bloom object you give the number of *bytes* and each byte is 8 buckets. Here you're giving the number of buckets.
insert(self, val)

Data and other attributes inherited from Bloom:
__dict__ = <dictproxy object>
dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'Bloom' objects>
list of weak references to the object (if defined)
bitmask = [128, 64, 32, 16, 8, 4, 2, 1]

 
Functions
       
mixarray_init(mixarray)

 
Data
        __all__ = ['Bloom']
mixarray = array('B', [49, 118, 63, 252, 13, ...])

Site Map
/Root
     AlternateThe Weird and Wonderful
          BacklinksWhat are backlinks
          John GilmoreWhat's Wrong with Copy Protection
     ArchivesBlog Archives
          OneArchive 1
          TwoArchive 2
          ThreeArchive 3
          FourArchive 4
          FiveArchive 5
          SixArchive 6
          SevenArchive 7
          EightArchive 8
          NineArchive 9
          TenArchive 10
          ElevenArchive 11
          TwelveArchive 12
          ThirteenArchive 13
          FourteenArchive 14
          FifteenArchive 15
          SixteenArchive 16
          SeventeenArchive 17
          EighteenArchive 18
          NineteenArchive 19
          Twenty Archive 20
          Twenty OneArchive 21
          Twenty TwoArchive 22
          Twenty ThreeArchive 23
          Twenty FourArchive 24
          Twenty FiveArchive 25
          Twenty SixArchive 26
          Twenty SevenArchive 27
          Twenty EightArchive 28
          Twenty NineArchive 29
          Thirty Archive 30
     PhotosPoor People Caught on Film
          Jack and the Beanstalk Jack and the Beanstalk
          RIP ScanResults of a Stage Scan Fire
          YosemiteYosemite National Park
     ProjectsIncomplete things from the lab
          Seagull's BaneLinux Automounter
          bttrackdBitTorrent Tracker
          CAPTCHACAPTCHA CGI script
          ConservConsole Serving
          DeerparkUsing Tor with Firefox/1.1 (Deerpark)
          DNSFixFixing DNS
          XoversXTA Crossover Control
          IAFSArchive Org Storage
          JBIG2JBIG2 Encoder
          VerifyPGP Key Verifier
          MaxFlowMaximal Flow in Python
          PyBloomBloom Filters in Python
          pyGnuTLSPython wrapping of GnuTLS
          SxmapApache SuEXEC Map
          HellardUnion Server Notes
     RecordingsFree recordings
          ICSM ChoirSt Paul's Church
     SchoolAncient School Stuff
     WritingsWho knows
          Cap SystemsCapability Systems
          IntroIntroduction to me
          SupremaJMC2 Group Project
          MP LettersLetters I've written to my MP
          SoundSound With Dramsoc
          SyncThreadingThe wonders of user-land threads