]> git.tuebingen.mpg.de Git - adu.git/blobdiff - bloom.h
First draft of hard link detection via bloom filters.
[adu.git] / bloom.h
diff --git a/bloom.h b/bloom.h
new file mode 100644 (file)
index 0000000..afb2298
--- /dev/null
+++ b/bloom.h
@@ -0,0 +1,12 @@
+struct bloom {
+       unsigned order;
+       unsigned num_hash_functions;
+       uint64_t num_entries;
+       uint64_t num_set_bits;
+       uint8_t *filter;
+};
+
+int bloom_init(unsigned bloom_filter_order, unsigned num_hash_functions,
+               struct bloom **result);
+void bloom_free(struct bloom *b);
+int bloom_test_and_insert(const uint8_t *data, size_t len, struct bloom *b);