Skip to content

beastOP/bloomfilter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BloomFilter

Build Status GoDoc

BloomFilter is a simple and efficient implementation of a Bloom filter in Go.

Installation

To install the package, run:

go get github.com/beastop/bloomfilter

Usage

Creating a Bloom Filter

package main

import (
	"fmt"
	"github.com/beastop/bloomfilter"
)

func main() {
	// Create a new Bloom filter
	bloom, err := bloomfilter.New(100, 0.01)
	if err != nil {
		fmt.Println("Error:", err)
		return
	}

	// Add items to the Bloom filter
	bloom.Add("foo")
	bloom.Add("bar")

	// Check if items are in the Bloom filter
	fmt.Println("foo in bloom filter:", bloom.Contains("foo"))
	fmt.Println("baz in bloom filter:", bloom.Contains("baz"))
}

Documentation

For detailed API documentation, please visit the GoDoc.

License

This project is licensed under the MIT License. See the LICENSE file for details.