Warning, /plasma/aura-browser/app/third-party/bloom-filter-cpp/README.md is written in an unsupported language. File is not indexed.

0001 [![Build Status](https://travis-ci.org/bbondy/bloom-filter-cpp.svg?branch=master)](https://travis-ci.org/bbondy/bloom-filter-cpp)
0002 
0003 # BloomFilter.cpp
0004 C++ Native node module Bloom filter written in C++ for use in node or any other C++ project.
0005 
0006 The Bloom filter tests whether an element belongs to a set. False positive matches are possible but not common, false negatives are not possible.
0007 The Bloom filter library also implements Rabin–Karp algorithm with Rabin fingerprint hashes for multiple substring searches.
0008 
0009 This is a port of a [similar lib](https://github.com/bbondy/bloom-filter-js) I prototyped in JS.
0010 
0011 ## To include bloom-filter-cpp in your project:
0012 
0013 ```
0014 npm install --save bloom-filter-cpp
0015 ```
0016 
0017 
0018 ## JS Usage
0019 
0020 ```javascript
0021 var BloomFilter = require('bloom-filter-cpp').BloomFilter
0022 
0023 var b1 = new BloomFilter()
0024 
0025 console.log('b1 ading hello')
0026 b1.add('hello')
0027 
0028 console.log('b1 exists hello? ', b1.exists('hello'))
0029 console.log('b1 exists hello2? ', b1.exists('hello2'))
0030 
0031 var b2 = new BloomFilter()
0032 console.log('b2 exists hello? ', b2.exists('hello'))
0033 console.log('b2 exists hello2? ', b2.exists('hello2'))
0034 ```
0035 
0036 
0037 ## C++ Usage
0038 
0039 ```c++
0040 #include "BloomFilter.h"
0041 #include <iostream>
0042 
0043 using namespace std;
0044 
0045 int main(int argc, char**argv) {
0046   BloomFilter b;
0047   b.add("Brian");
0048   b.add("Ronald");
0049   b.add("Bondy");
0050 
0051   // Prints true
0052   cout << (b.exists("Brian") ? "true" : "false") << endl;
0053 
0054   // Prints false
0055   cout << (b.exists("Brian Ronald") ? "true" : "false") << endl;
0056 
0057   // Create a new BloomerFilter form a previous serialization
0058   BloomFilter b2(b.getBuffer(), b.getByteBufferSize());
0059 
0060   // Prints the same as above
0061   cout << (b2.exists("Brian") ? "true" : "false") << endl;
0062   cout << (b2.exists("Brian Ronald") ? "true" : "false") << endl;
0063 
0064   // And you can check if any substring of a passed string exists
0065   // Prints true
0066   cout << (b.substringExists("Hello my name is Brian", 5) ? "true" : "false") << endl;
0067   // Prints false
0068   cout << (b.substringExists("Hello my name is Bri", 3) ? "true" : "false") << endl;
0069 
0070   return 0;
0071 }
0072 ```
0073 
0074 
0075 ## Developing bloom-filter-cpp
0076 
0077 ````
0078 git clone bloom-filter-cpp
0079 npm install
0080 ```
0081 
0082 ## Build everything in release
0083 
0084 ```
0085 make
0086 ```
0087 
0088 ## Running sample
0089 
0090 ```
0091 make sample
0092 ```
0093 
0094 ## Running tests
0095 
0096 ```
0097 make test
0098 ```
0099 
0100 ## Clearing build files
0101 ```
0102 make clean
0103 ```