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

Implementation of the millionaire problem 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 millionaire_prob.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ALICE   "ALICE"
 
#define BOB   "BOB"
 

Functions

int32_t test_millionaire_prob_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 solving the millionaire's problem. More...
 
shareBuildMillionaireProbCircuit (share *s_alice, share *s_bob, BooleanCircuit *bc)
 This function is used to build and solve the millionaire's problem. More...
 

Detailed Description

Implementation of the millionaire problem using ABY Framework.

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

Function Documentation

share* BuildMillionaireProbCircuit ( share s_alice,
share s_bob,
BooleanCircuit bc 
)

This function is used to build and solve the millionaire's problem.

Parameters
s_aliceshared object of alice.
s_bobshared object of bob.
bcboolean circuit object.

Calling the greater than equal function in the Boolean circuit class.

int32_t test_millionaire_prob_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 solving the millionaire's problem.

Parameters
rolerole played by the program which can be server or client part.
addressIP Address
seclvlSecurity level
nvalsNumber of values
bitlenBit length of the inputs
nthreadsNumber of threads
mt_algThe algorithm for generation of multiplication triples
sharingSharing type object

Step 1: Create the ABYParty 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 sharing types available in the program.

Step 3: Create the circuit object on the basis of the sharing type being inputed.

Step 4: Creating the share objects - s_alice_money, s_bob_money which is used as input to the computation function. Also s_out which stores the output.

Step 5: Initialize Alice's and Bob's money with random values. Both parties use the same seed, to be able to verify the result. In a real example each party would only supply one input value.

Step 6: Copy the randomly generated money into the respective share objects using the circuit object method PUTInGate(). Also mention who is sharing the object. The value for the party different from role is ignored, but PutINGate() must always be called for both roles.

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: Modify the output receiver based on the role played by the server and the client. This step writes the output to the shared output object based on the role.

Step 9: Executing the circuit using the ABYParty object evaluate the problem.

Step 10:Type casting the value to 32 bit unsigned integer for output.