Exemplo n.º 1
0
 private void InitPolyCommit()
 {
     if (Size > 0)
     {
         PolyCommit = new PolyCommit();
         PolyCommit.Setup((int)Math.Ceiling(Size / 3.0), Seed);
     }
 }
Exemplo n.º 2
0
 private void InitPolyCommit()
 {
     if (Size > 0)
     {
         PolyCommit = new PolyCommit();
         PolyCommit.Setup((int)Math.Ceiling(Size / 3.0), Seed);
     }
 }
Exemplo n.º 3
0
        public ShareRenewalRound(Party me, Quorum quorumFrom, Quorum quorumTo, BigZp[] startShares, BigInteger prime, int startSharesPerParty, int finalSharesPerParty, ulong protocolId)
            : base(me, new Quorum[] { quorumFrom, quorumTo }, protocolId)
        {
            FinalSharesPerParty = finalSharesPerParty;
            StartSharesPerParty = startSharesPerParty;
            StartShares         = startShares;
            Prime = prime;
            ReceivedReshareCount = 0;

            foreach (var from in Quorums[0].Members)
            {
                sharesRecv[from] = new List <ShareWitnessMsg <BigZp> > [startSharesPerParty];
                for (int i = 0; i < startSharesPerParty; i++)
                {
                    numCommitsRecv[from] = 0;
                    sharesRecv[from][i]  = new List <ShareWitnessMsg <BigZp> >();
                }
            }

            StartShareCount = Quorums[FROM].Size * StartSharesPerParty;
            FinalShareCount = Quorums[TO].Size * FinalSharesPerParty;
            NewPolyDeg      = (int)Math.Ceiling(FinalShareCount / 3.0) - 1;

            VandermondeInv = StaticCache.GetVandermondeInvColumn(Prime, StartShareCount);

            if (Quorums[TO].HasMember(Me.Id))
            {
                var quorumIter = Quorums[TO].Members.GetEnumerator();
                int i          = 0;
                while (quorumIter.MoveNext())
                {
                    if (Me.Id == quorumIter.Current)
                    {
                        MyQuorumIndex = i;
                        break;
                    }
                    i++;
                }
            }

            if (Quorums[TO] is ByzantineQuorum)
            {
                var byzTo = Quorums[TO] as ByzantineQuorum;
                if (FinalShareCount == Quorums[TO].Size)
                {
                    PolyCommit = byzTo.PolyCommit;
                }
                else
                {
                    PolyCommit = new PolyCommit();
                    PolyCommit.Setup(NewPolyDeg + 1, byzTo.Seed);
                }
            }
        }