Exemple #1
0
        public void ShouldKnowIfAPointIsOnMattsCurve(int x, int y, bool expectedResult)
        {
            var mattsCurve = new EdwardsCurve(Curve.Ed25519, 7, 2, 3, new EdPoint(0, 6), 12, 256, 247, 2);
            var result     = mattsCurve.PointExistsOnCurve(new EdPoint(x, y));

            Assert.AreEqual(expectedResult, result);
        }
Exemple #2
0
        public void ShouldEncodeAndDecodeProperlyMattsCurve3(string encoded, int expectedX, int expectedY)
        {
            var encodedOriginal = new BitString(encoded);
            var mattsCurve      = new EdwardsCurve(Curve.Ed25519, 13, 1, 2, new EdPoint(0, 6), 12, 8, 247, 2);

            var decoded = mattsCurve.Decode(encodedOriginal);

            Assert.IsTrue(mattsCurve.PointExistsOnCurve(decoded));

            Assert.AreEqual(expectedX, (int)decoded.X);
            Assert.AreEqual(expectedY, (int)decoded.Y);

            var reEncoded = mattsCurve.Encode(decoded);

            Assert.AreEqual(encodedOriginal, reEncoded);
        }