コード例 #1
0
ファイル: Authority.cs プロジェクト: dbrgn/pi-vote
        public Authority(DeserializeContext context, BaseParameters parameters)
        {
            Index = context.ReadInt32();
              this.polynomial = context.ReadObject<Polynomial>();

              if (!context.ReadBoolean())
              {
            this.secretKeyPart = context.ReadBigInt();
              }

              this.parameters = parameters;
        }
コード例 #2
0
ファイル: Authority.cs プロジェクト: dbrgn/pi-vote
        /// <summary>
        /// Create one's own polynomial.
        /// </summary>
        /// <param name="degree">Degress of the polynomial. Equal to the cryptographic thereshold.</param>
        public void CreatePolynomial()
        {
            if (this.polynomial != null)
            throw new InvalidOperationException("Polynom already created.");

              this.polynomial = new Polynomial();

              while (this.polynomial.Degree < this.parameters.Thereshold)
              {
            this.polynomial.AddCoefficient(this.parameters.Random());
              }
        }