コード例 #1
0
ファイル: VoteTest.cs プロジェクト: dbrgn/pi-vote
        public void VoteInvalidVerifyTest()
        {
            for (int i = 0; i < 100; i++)
              {
            this.publicKey = parameters.Random();

            Vote vote0 = new Vote(2, this.parameters.Random(), this.parameters, this.publicKey, FakeType.BadDisjunction);
            Assert.IsFalse(vote0.Verify(this.publicKey, this.parameters, RandomNumberGenerator.Create(), BaseParameters.StandardProofCount));

            Vote vote1 = new Vote(2, this.parameters.Random(), this.parameters, this.publicKey, FakeType.BadFiatShamir);
            Assert.IsFalse(vote1.Verify(this.publicKey, this.parameters, RandomNumberGenerator.Create(), BaseParameters.StandardProofCount));

            Vote vote2 = new Vote(2, this.parameters.Random(), this.parameters, this.publicKey, FakeType.BadPowerMod);
            Assert.IsFalse(vote2.Verify(this.publicKey, this.parameters, RandomNumberGenerator.Create(), BaseParameters.StandardProofCount));
              }
        }
コード例 #2
0
ファイル: VoteTest.cs プロジェクト: dbrgn/pi-vote
        public void VoteVerifyTest()
        {
            for (int i = 0; i < 100; i++)
              {
            this.publicKey = parameters.Random();

            Vote vote = new Vote(0, this.parameters.Random(), this.parameters, this.publicKey, new Progress(null));

            Assert.IsTrue(vote.Verify(this.publicKey, this.parameters, RandomNumberGenerator.Create(), BaseParameters.StandardProofCount));
              }
        }