Пример #1
0
        public static void SetupReconstructionProtocol(Quorum quorum)
        {
            int n       = quorum.Size;
            var input   = new BigZp(prime, 20);
            var polyDeg = (int)Math.Ceiling(n / 3.0) - 1;

            var shares = BigShamirSharing.Share(input, n, polyDeg);

            for (int i = 0; i < n; i++)
            {
                TestParty <BigZp>      party = new TestParty <BigZp>();
                ReconstructionProtocol rp    = new ReconstructionProtocol(party, quorum, new Share <BigZp>(shares[i]));
                party.UnderTest = rp;
                NetSimulator.RegisterParty(party);
            }
        }
Пример #2
0
        private void SetupReconstruction()
        {
            ReconstructProtocolMapping = new Dictionary <OutputGateAddress, ulong>();
            List <Protocol> reconstructionProtocols = new List <Protocol>();

            foreach (var quorumResults in CircuitResultsPerQuorum)
            {
                foreach (var singleResult in quorumResults.Value)
                {
                    var protocol = new ReconstructionProtocol(Me, quorumResults.Key, singleResult.Value.Item2); // don't worry about reconstructing the sort shares
                    ReconstructProtocolMapping[singleResult.Key] = protocol.ProtocolId;
                    reconstructionProtocols.Add(protocol);
                }
            }

            CircuitResultsPerQuorum = null;

            ExecuteSubProtocols(reconstructionProtocols);
        }
Пример #3
0
        public static void SetupReconstructionProtocol(Quorum quorum)
        {
            int n = quorum.Size;
            var input = new BigZp(prime, 20);
            var polyDeg = (int)Math.Ceiling(n / 3.0) - 1;

            var shares = BigShamirSharing.Share(input, n, polyDeg);
            for (int i = 0; i < n; i++)
            {
                TestParty<BigZp> party = new TestParty<BigZp>();
                ReconstructionProtocol rp = new ReconstructionProtocol(party, quorum, new Share<BigZp>(shares[i]));
                party.UnderTest = rp;
                NetSimulator.RegisterParty(party);
            }
        }