ABY Framework  1.0
Arithmetic Bool Yao Framework
 All Classes Files Functions Variables Enumerations Enumerator Macros
cuckoo.h
1 /*
2  * cuckoo.h
3  *
4  * Created on: Oct 7, 2014
5  * Author: mzohner
6  */
7 
8 #ifndef CUCKOO_H_
9 #define CUCKOO_H_
10 
11 #include "hashing_util.h"
12 
13 
14 //TEST CHANGE
15 //TEST CHANGE PSI->Hashing
16 //This is a test
17 //This is a test from ABY to PSI and Hashing
18 #define MAX_ITERATIONS 1024
19 //#define DEBUG_CUCKOO
20 #ifdef TEST_UTILIZATION
21 #define COUNT_FAILS
22 #endif
23 //#define DOUBLE_TABLE
24 //#define TEST_CHAINLEN
25 
26 #ifdef TEST_CHAINLEN
27 static uint64_t chain_cnt[MAX_ITERATIONS];
28 void print_chain_cnt();
29 #endif
30 
32  //id of the element in the source set
33  uint32_t eleid;
34  //addresses the bin of the cuckoo entry in the cuckoo table, will only work for up to 2^{32} bins
35  uint32_t *address;
36  //the value of the entry
37  uint8_t* val;
38  //which position is the entry currently mapped to
39  uint32_t pos;
40 #ifdef DEBUG_CUCKOO
41  uint8_t* element;
42 #endif
43 };
44 
45 
46 
48  //starting position in the generation process
49  uint32_t startpos;
50  //end position of entries that are generated by this thread
51  uint32_t endpos;
52  //input elements
53  uint8_t* elements;
54  //pointer to the cuckoo entries
55  cuckoo_entry_ctx* cuckoo_entries;
56  hs_t* hs;
57 };
58 
59 
60 //returns a cuckoo hash table with the first dimension being the bins and the second dimension being the pointer to the elements
61 #ifndef TEST_UTILIZATION
62 uint8_t*
63 #else
64 uint32_t
65 #endif
66 cuckoo_hashing(uint8_t* elements, uint32_t neles, uint32_t nbins, uint32_t bitlen, uint32_t *outbitlen, uint32_t* nelesinbin,
67  uint32_t* perm, uint32_t ntasks, uint8_t** stash_elements, uint32_t maxstashsize, uint32_t** stashperm, uint32_t nhashfuns,
68  prf_state_ctx* prf_state);
69 //routine for generating the entries, is invoked by the threads
70 void *gen_cuckoo_entries(void *ctx);
71 inline void gen_cuckoo_entry(uint8_t* in, cuckoo_entry_ctx* out, hs_t* hs, uint32_t ele_id);
72 inline bool insert_element(cuckoo_entry_ctx** ctable, cuckoo_entry_ctx* element, uint32_t max_iterations, uint32_t nhashfuns);
73 inline uint32_t compute_stash_size(uint32_t nbins, uint32_t neles);
74 
75 
76 
77 #endif /* CUCKOO_H_ */
Definition: cuckoo.h:31
Definition: cuckoo.h:47
Definition: hashing_util.h:23
Definition: crypto.h:52