ABY Framework  1.0
Arithmetic Bool Yao Framework
 All Classes Files Functions Variables Enumerations Enumerator Macros
Functions
euclidean_dist.h File Reference

Implementation of the Euclidean Distance using ABY Framework. More...

#include "../../../abycore/circuit/booleancircuits.h"
#include "../../../abycore/circuit/arithmeticcircuits.h"
#include "../../../abycore/circuit/circuit.h"
#include "../../../abycore/aby/abyparty.h"
#include <math.h>
#include <cassert>
Include dependency graph for euclidean_dist.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

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...
 
shareBuildEuclidDistanceCircuit (share *s_x1, share *s_x2, share *s_y1, share *s_y2, BooleanCircuit *bc)
 This function is used to build and find the Euclidean Distance. More...
 

Detailed Description

Implementation of the Euclidean Distance using ABY Framework.

Author
sreer.nosp@m.am.s.nosp@m.adasi.nosp@m.vam@.nosp@m.cased.nosp@m..de

Function Documentation

share* BuildEuclidDistanceCircuit ( share s_x1,
share s_x2,
share s_y1,
share s_y2,
BooleanCircuit bc 
)

This function is used to build and find the Euclidean Distance.

Parameters
s_x1shared object of first coordinate x1.
s_y1shared object of first coordinate y1.
s_x2shared object of first coordinate x2.
s_y2shared object of first coordinate y2.
bcboolean circuit object.

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.

Parameters
rolerole played by the program which can be server or client part.
addressIP Address
seclvlSecurity level
nvalsnumber of values
bitlenBit Length
nthreadsnthreads
mt_alg_________
sharingsharing 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.