ABY Framework
1.0
Arithmetic Bool Yao Framework
|
Testing the implementation of the Euclidean distance for two coordinates. More...
#include "euclidean_dist.h"
Functions | |
int32_t | test_euclid_dist_circuit (e_role role, char *address, seclvl seclvl, uint32_t nvals, uint32_t bitlen, uint32_t nthreads, e_mt_gen_alg mt_alg, e_sharing sharing) |
This function is used for running a testing environment for finding the Euclidean Distance. More... | |
share * | BuildEuclidDistanceCircuit (share *s_x1, share *s_x2, share *s_y1, share *s_y2, BooleanCircuit *bc) |
Builds a Euclidean distance circuit for two pairs of coordinate shares. More... | |
Testing the implementation of the Euclidean distance for two coordinates.
share* BuildEuclidDistanceCircuit | ( | share * | s_x1, |
share * | s_x2, | ||
share * | s_y1, | ||
share * | s_y2, | ||
BooleanCircuit * | bc | ||
) |
Builds a Euclidean distance circuit for two pairs of coordinate shares.
This function is used to build and find the Euclidean Distance.
Following code performs (x2-x1)*(x2-x1)
Following code performs (y2-y1)*(y2-y1)
Following code performs out = res_y + res_x
int32_t test_euclid_dist_circuit | ( | e_role | role, |
char * | address, | ||
seclvl | seclvl, | ||
uint32_t | nvals, | ||
uint32_t | bitlen, | ||
uint32_t | nthreads, | ||
e_mt_gen_alg | mt_alg, | ||
e_sharing | sharing | ||
) |
This function is used for running a testing environment for finding the Euclidean Distance.
role | role played by the program which can be server or client part. |
address | IP Address |
seclvl | Security level |
nvals | number of values |
bitlen | Bit Length |
nthreads | nthreads |
mt_alg | _________ |
sharing | sharing type object |
Step 1: Create the ABY Party object which defines the basis of all the operations which are happening. Operations performed are on the basis of the role played by this object.
Step 2: Get to know all the sharings available in the program.
Step 3: Create the circuit object on the basis of the sharing type being inputted.
Step 4: Create the share objects s_x1, s_y1, s_x2, s_y2 that are the inputs to the circuit. s_out will store the output.
Step 5: Initialize plaintext values of x1, x2, y1, y2 with random values. Here, both parties will select the same random values, since they start at the same time (they wait for each other). In real life every party, would only know one pair of coordinates - here we know both pairs for verification later on.
Step 6: Set the coordinates as inputs for the circuit for the respective party. The other party's inputs must be specified but can be set arbitrarily (dummy). The values will be secret shared before the circuit evaluation.
Step 7: Call the build method for building the circuit for the problem by passing the shared objects and circuit object. Don't Forget to type cast the circuit object to type of share
Step 8: Write the circuit output to s_out for both parties.
Step 9: Execute the circuit using the ABYParty object
Step 10: Print plaintext output of the circuit.