Exemplo n.º 1
0
 static void AddRow(UdpClient client, Rational max_budget, UInt32[] values, RSACryptoServiceProvider ironclad_public_key, Random rng)
 {
     AddRowRequest addRowRequest = new AddRowRequest(values, max_budget, rng);
     byte[] request = addRowRequest.GetPacket(ironclad_public_key);
     byte[] response = CommonRoutines.SendRequest(client, request, "AddRow");
     AddRowResponse addRowResponse = new AddRowResponse(response);
 }
Exemplo n.º 2
0
 static void InitializeDB(UdpClient client, Rational budget)
 {
     InitializeDBRequest initializeDBRequest = new InitializeDBRequest(budget);
     byte[] request = initializeDBRequest.GetPacket();
     byte[] response = CommonRoutines.SendRequest(client, request, "InitializeDB");
     InitializeDBResponse initializeDBResponse = new InitializeDBResponse(response);
 }
Exemplo n.º 3
0
 public AddRowRequest(UInt32[] i_values, Rational i_max_budget, Random rng)
 {
     values = i_values;
     max_budget = i_max_budget;
     nonce = new byte[Parameters.nonceBytes];
     rng.NextBytes(nonce);
 }
Exemplo n.º 4
0
 static void PerformQuery(UdpClient client, UInt32 row_min, UInt32 row_max, UInt32 answer_units, UInt32 answer_min,
                          UInt32 answer_max, Rational alpha, Rational beta, UInt32[] program)
 {
     QueryRequest queryRequest = new QueryRequest(row_min, row_max, answer_units, answer_min, answer_max, alpha, beta, program);
     byte[] request = queryRequest.GetPacket();
     byte[] response = CommonRoutines.SendRequest(client, request, "Query");
     QueryResponse queryResponse = new QueryResponse(response);
     Console.Error.WriteLine("Noised answer received was {0}", queryResponse.ResponseValue);
 }
Exemplo n.º 5
0
 public QueryRequest(UInt32 i_row_min, UInt32 i_row_max, UInt32 i_answer_units, UInt32 i_answer_min, UInt32 i_answer_max,
                     Rational i_alpha, Rational i_beta, UInt32[] i_program)
 {
     row_min = i_row_min;
     row_max = i_row_max;
     answer_units = i_answer_units;
     answer_min = i_answer_min;
     answer_max = i_answer_max;
     alpha = i_alpha;
     beta = i_beta;
     program = i_program;
 }
Exemplo n.º 6
0
        static void Main(string[] args)
        {
            Parameters.ApplyArguments(args);
            Profiler.Initialize();
            UdpClient client = CommonRoutines.StartClient();

            Console.Error.WriteLine("Getting Ironclad public key");
            RSACryptoServiceProvider ironclad_public_key = CommonRoutines.GetIroncladPublicKey(client);

            UInt32 row_min = 0;
            UInt32 row_max = 1;
            UInt32 answer_units = 1;
            UInt32 answer_min = 0;
            UInt32 answer_max = (UInt32)Parameters.numRows;
            Rational alpha = new Rational(1009, 1000);
            Rational beta = new Rational(101, 100);
            UInt32[] program = MakeProgram();

            Rational budget = new Rational((UInt32) Math.Ceiling(Math.Pow(beta.Value, Parameters.numQueries * 3)));
            
            Console.Error.WriteLine("Initializing database");
            for (UInt32 run_number = 0; run_number < CommonParams.numberOfRuns; ++run_number)
            {
                InitializeDB(client, budget);
            }

            Random rng = new Random();
            for (UInt32 row_number = 0; row_number < Parameters.numRows; ++row_number)
            {
                Console.Error.WriteLine("Adding row {0}", row_number + 1);
                UInt32[] row = GetRandomRow(rng);
                AddRow(client, budget, row, ironclad_public_key, rng);
            }

            Console.Error.WriteLine("Performing queries");

            for (UInt32 query_number = 0; query_number < Parameters.numQueries; ++query_number)
            {
                Console.Error.WriteLine("Performing query {0}", query_number + 1);
                PerformQuery(client, row_min, row_max, answer_units, answer_min, answer_max, alpha, beta, program);
            }

            Profiler.Print();
        }
Exemplo n.º 7
0
 public InitializeDBRequest(Rational i_budget)
 {
     budget = i_budget;
 }
Exemplo n.º 8
0
 public InitializeDBRequest(Rational i_budget)
 {
     budget = i_budget;
 }