cuckoofilter

package
v0.0.0-...-f966322 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 10, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BUCKET_SIZE     = 4    //
	MAX_KICK_NUM    = 1024 //Max number of kicks allowed
	FP_SEED         = 2020 // Seeds for calculating fingerprints (SHA256)
	FP_SEED2        = 2021 // Seeds for calculating alternative fingerprints (SHA256)
	CAPACITY_FACTOR = 0.9  // Increase the filter's size by a factor to allow better capacity
)

Variables

This section is empty.

Functions

func GetFP

func GetFP(element []byte) []byte

This function returns a SHA224 hash output as the fingerprint of the given input element

func GetFP2

func GetFP2(element []byte) []byte

This function returns a SHA224 hash output as the fingerprint of the given input element under a different seed

func GetFPI1I2

func GetFPI1I2(element []byte, numBuckets uint) ([]byte, uint, uint)

This function returns a SHA224 fingerprint and two indexes for the given input element

Types

type CFilter

type CFilter struct {
	// contains filtered or unexported fields
}

func InitCFilter

func InitCFilter(setSize uint) *CFilter

This function initializes a filter given the size of input set

func (*CFilter) Add

func (cf *CFilter) Add(element []byte) bool

This function add one element into the current filter

func (*CFilter) Filter2Bytes

func (cf *CFilter) Filter2Bytes() [][]byte

This function encode the current filter into []bytes

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL