aboutsummaryrefslogtreecommitdiff
path: root/src/lib/crypt_ops/digestset.h
blob: 3b5d62c310c3d92664f3c4f9726c8188eb5193e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/* Copyright (c) 2018, The Tor Project, Inc. */
/* See LICENSE for licensing information */

/**
 * \file digestset.h
 * \brief Types to handle sets of digests, based on bloom filters.
 **/

#ifndef TOR_DIGESTSET_H
#define TOR_DIGESTSET_H

#include "orconfig.h"
#include "lib/cc/torint.h"
#include "lib/container/bloomfilt.h"

/**
 * An digestset_t represents a set of 20-byte digest values. The
 * implementation is probabilistic: false negatives cannot occur but false
 * positives are possible.
 */
typedef struct bloomfilt_t digestset_t;

digestset_t *digestset_new(int max_addresses_guess);
#define digestset_free(set) bloomfilt_free(set)
void digestset_add(digestset_t *set, const char *addr);
int digestset_probably_contains(const digestset_t *set,
                                const char *addr);

// XXXX to remove.
#define digestset_contains digestset_probably_contains

#endif