1
0
mirror of https://github.com/CovidBraceletPrj/CovidBracelet.git synced 2024-06-06 12:47:53 +02:00
CovidBracelet/src/bloom.h

30 lines
705 B
C
Raw Normal View History

#ifndef BLOOM_H
#define BLOOM_H
#include "ens/storage.h"
2021-07-30 00:36:36 +02:00
typedef uint32_t (*hash_function)(const void* data);
typedef struct bloom_hash {
hash_function func;
struct bloom_hash* next;
} bloom_hash_t;
typedef struct bloom_filter {
bloom_hash_t* func;
uint8_t* data;
size_t size;
} bloom_filter_t;
/**
* Initialize the bloom filter on basis of the already registerred records.
*/
2021-08-09 12:50:20 +02:00
bloom_filter_t* bloom_create(size_t size);
// TODO lome: maybe only use RPI (should be sufficient)
2021-07-30 00:36:36 +02:00
void bloom_add_record(bloom_filter_t* bloom, record_t* record);
// TODO lome: maybe only use RPI (should be sufficient)
2021-07-30 00:36:36 +02:00
bool bloom_probably_has_record(bloom_filter_t* bloom, record_t* record);
#endif