Exemplo n.º 1
0
        static Sect283K1()
        {
            var m  = 283;
            var ks = new[] { 5, 7, 12 };

            var field = new Char2Field(m, ks);
            var curve = new Char2Curve(field, field.Value(0), field.Value(1));

            // cofactor = 1

            Parameters = new Char2DomainParameters(
                m: m,
                ks: ks,
                a: curve.A.Value,
                b: curve.B.Value,
                g: curve.PointFromBinary(HexConverter.FromHex("04" +
                                                              "0503213F78CA44883F1A3B8162F188E553CD265F23C1567A16876913B0C2AC2458492836" +
                                                              "01CCDA380F1C9E318D90F95D07E5426FE87E45C0E8184698E45962364E34116177DD2259")),
                n: "01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE9AE2ED07577265DFF7F94451E061E163C61".HexToBigInteger());
        }
Exemplo n.º 2
0
        public void TestAddition()
        {
            var field = new Char2Field(4, 1);

            Assert.Equal(field.Value(0b0100), field.Add(field.Value(0b1101), field.Value(0b1001)));
        }
Exemplo n.º 3
0
        public void TestMultiplicativeInverse()
        {
            var field = new Char2Field(4, 1);

            Assert.Equal(field.Value(0b0100), field.Divide(field.Value(0b0001), field.Value(0b1101)));
        }
Exemplo n.º 4
0
        public void TestMultiplication()
        {
            var field = new Char2Field(4, 1);

            Assert.Equal(field.Value(0b0101), field.Multiply(field.Value(0b1101), field.Value(0b0111)));
        }
Exemplo n.º 5
0
        public void TestNegation()
        {
            var field = new Char2Field(4, 1);

            Assert.Equal(field.Value(0b1101), field.Negate(field.Value(0b1101)));
        }
Exemplo n.º 6
0
        public void TestSubtraction()
        {
            var field = new Char2Field(4, 1);

            Assert.Equal(field.Value(0b1001), field.Sub(field.Value(0b1101), field.Value(0b0100)));
        }
Exemplo n.º 7
0
        public void TestAdditiveIdentity()
        {
            var field = new Char2Field(4, 1);

            Assert.Equal(field.Value(0b0000), field.Add(field.Value(0b1101), field.Value(0b1101)));
        }