Skip to content

Instantly share code, notes, and snippets.

@arriqaaq
Created September 28, 2018 15:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arriqaaq/7b57bd6e4adcd18f382cc6114c5ea851 to your computer and use it in GitHub Desktop.
Save arriqaaq/7b57bd6e4adcd18f382cc6114c5ea851 to your computer and use it in GitHub Desktop.
func (c *CuckooFilter) Lookup(data []byte) bool {
// f = fingerprint(x);
// i1 = hash(x);
// i2 = i1 ⊕ hash(f);
// if bucket[i1] or bucket[i2] has f then
// return True;
// return False;
i1, i2, f := c.getCuckooParams(data)
if c.buckets[i1].contains(f) || c.buckets[i2].contains(f) {
return true
}
return false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment