示例#1
0
        private bool IsMultStepShareLegal(MultStepBCaseShare recvShareFromPlayer_i, MultStepVerificationPoly recvVerifcationPolynomial)
        {
            if (!IsRecvShareLegal(recvShareFromPlayer_i))
            {
                return(false);
            }

            var RxPolynomial = recvVerifcationPolynomial.RxPolynomial;
            Zp  Ratpoint0    = Zp.EvalutePolynomialAtPoint(RxPolynomial, new Zp(Prime, 0));

            if (!Ratpoint0.Equals(new Zp(Prime, 0)))
            {
                return(false);
            }
            int w                      = NumTheoryUtils.GetFieldMinimumPrimitive(Prime);
            var w_InMyIndex            = new Zp(Prime, NumTheoryUtils.ModPow(w, Party.Id, Prime));
            Zp  RjFromPublicPolynomial = Zp.EvalutePolynomialAtPoint(RxPolynomial, w_InMyIndex);

            Zp temp = recvShareFromPlayer_i.AShare.ConstMul(recvShareFromPlayer_i.BShare).ConstSub(recvShareFromPlayer_i.AbShare);
            Zp RjFromRecvPrivateInfo = w_InMyIndex.ConstMul(recvShareFromPlayer_i.RShare).ConstAdd(temp);

            if (!RjFromPublicPolynomial.Equals(RjFromRecvPrivateInfo))
            {
                return(false);
            }

            return(true);
        }
示例#2
0
 public static bool CheckSharedSecrets(Zp secret, int numberOfPlayers,
     int polynomDeg, int prime)
 {
     return secret.Equals(Recombine(Share(secret, numberOfPlayers, polynomDeg), polynomDeg, prime));
 }
示例#3
0
 public static bool CheckSharedSecrets(Zp secret, int numberOfPlayers,
                                       int polynomDeg, int prime)
 {
     return(secret.Equals(Recombine(Share(secret, numberOfPlayers, polynomDeg), polynomDeg, prime)));
 }