Populating the HVE:
Preliminaries
For GenToken: You do not have to populate all sectors of your HVE_t, only the ones that you would like to query. For example, there may be one sector in your HVE_t with a query that you do not care to check. By leaving the sector unpopulated, it acts as a wild card, and any value in the HVE_t sector in encrypt is acceptable.
Populate a Comparison Query Sector: declare a variable of type
HVE_COMPARISON_t
as follows:
HVE_COMPARISON_t comp = { size_t value, int sector};
int HVE_Insert_Comparison(HVE_t *HVE, HVE_COMPARISON_t *comp);
value
is the number to be used in the comparison.sector
specifies the sector number of the HVE to be populated withvalue
.
Populate an Equality Query sector: declare a variable of type
HVE_EQUALITY_t
as follows:
HVE_EQUALITY_t eq = {char *text, int text_len , int sector};
int HVE_Insert_Equality(HVE_t *HVE, HVE_EQUALITY *eq);
text
is the actual character string to be used in the equality query.text_len
is the length of the character string.sector
specifies the sector number of the HVE to be populated withtext
.
Populate a Subset Query sector: follow the below steps:
- Specify the values to be used in the query by declaring an array
of type
HVE_SUBSET_DATA_t
. EachHVE_SUBSET_DATA_t
entry consists of a character string and its length. The array must be terminated with anHVE_SUBSET_DATA_t
equal to{END, END}
. This last entry must be taken into the length of the array.HVE_SUBSET_DATA_t data[num_elem_in_subset]= { {"str1", str1_len}, {"str2", str2_len}, .. ..., {END, END} };
- Second specify which sector in the HVE this data is populating by
declaring a variable of type HVE_SUBSET_t and using the above
HVE_SUBSET_DATA_t to initialize it as follows:
HVE_SUBSET_t sub = { data, num_elem_in_sub, sector}; int HVE_Insert_Subset(HVE_t *HVE, HVE_SUBSET_t *sub);
HVE_RAW_t
as follows:
HVE_RAW_t raw = {int value, int sector};
int HVE_Insert_Raw(HVE_t *HVE, HVE_Equality *eq);
value
is the actual number to be used in the raw query.sector
specifies the sector number of the HVE to be populated with the rawvalue
.