Ejemplo n.º 1
0
        public void GenerateAliceIdentifiers(int no_ids, int length_of_id, string file)
        {
            for (int i = 0; i < no_ids; i++)
            {
                Series id = new Series(length_of_id);

                alice_ids.Add(id);
                transmitter.WriteSeriesToFile(alice_ids, file);
            }

            unique_identifiers_file = file;
        }
Ejemplo n.º 2
0
        public void ReceiveMissingBanknotesPartsFromAlice()
        {
            int no_secrets = BitConverter.ToInt32(alice_connection.Receive(0), 0);
            alice_connection.Send(0, new byte[1]);

            Console.WriteLine("\t[debug]: Waiting for {0} secrets.", no_secrets - 1);

            secrets = new List<BigInteger>();

            for (int i = 0; i < no_secrets; i++)
            {
                if (i != banknote_index)
                {
                    secrets.Add(new BigInteger(alice_connection.Receive(0)));
                    alice_connection.Send(0, new byte[1]);
                    Console.WriteLine("\t[debug]: Secret {0} received: {1}", i, secrets[i]);
                } else
                {
                    secrets.Add(new BigInteger("1"));
                    Console.WriteLine("\t[debug]: Secret for index {0} ommited.", i);
                }
            }

            Console.WriteLine("[info]: Received from Alice {0} secrets (to reveal banknotes).", secrets.Count() - 1);

            int no_series = BitConverter.ToInt32(alice_connection.Receive(0), 0);
            alice_connection.Send(0, new byte[1]);

            Console.WriteLine("\t[debug]: Waiting for {0} (S, B, L, T, C, R) series.", no_series * 6);

            t_series = new List<Series>();
            c_series = new List<Series>();
            s_series = new List<Series>();
            b_series = new List<Series>();

            l_secret = new List<Series>();
            r_secret = new List<Series>();

            var tmp = new Series();

            for (int i = 0; i < no_series; i++)
            {
                tmp.Receive(alice_connection);
                s_series.Add(tmp);

                tmp.Receive(alice_connection);
                b_series.Add(tmp);

                tmp.Receive(alice_connection);
                l_secret.Add(tmp);

                tmp.Receive(alice_connection);
                t_series.Add(tmp);

                tmp.Receive(alice_connection);
                c_series.Add(tmp);

                tmp.Receive(alice_connection);
                r_secret.Add(tmp);

                Console.WriteLine("\t[debug]: {0} received.", (i + 1) * 6);
            }

            Console.WriteLine("[info]: {0} series (S, B, L, T, C, R) received.", s_series.Count() * 6);
        }