コード例 #1
0
        public virtual AbstractF2mPoint TauPow(int pow)
        {
            //IL_00bc: Unknown result type (might be due to invalid IL or missing references)
            if (base.IsInfinity)
            {
                return(this);
            }
            ECCurve        curve            = Curve;
            int            coordinateSystem = curve.CoordinateSystem;
            ECFieldElement rawXCoord        = base.RawXCoord;

            switch (coordinateSystem)
            {
            case 0:
            case 5:
            {
                ECFieldElement rawYCoord2 = base.RawYCoord;
                return((AbstractF2mPoint)curve.CreateRawPoint(rawXCoord.SquarePow(pow), rawYCoord2.SquarePow(pow), base.IsCompressed));
            }

            case 1:
            case 6:
            {
                ECFieldElement rawYCoord      = base.RawYCoord;
                ECFieldElement eCFieldElement = base.RawZCoords[0];
                return((AbstractF2mPoint)curve.CreateRawPoint(rawXCoord.SquarePow(pow), rawYCoord.SquarePow(pow), new ECFieldElement[1] {
                        eCFieldElement.SquarePow(pow)
                    }, base.IsCompressed));
            }

            default:
                throw new InvalidOperationException("unsupported coordinate system");
            }
        }
コード例 #2
0
        public virtual AbstractF2mPoint TauPow(int pow)
        {
            if (base.IsInfinity)
            {
                return(this);
            }
            ECCurve        curve            = this.Curve;
            int            coordinateSystem = curve.CoordinateSystem;
            ECFieldElement rawXCoord        = base.RawXCoord;

            switch (coordinateSystem)
            {
            case 0:
            case 5:
            {
                ECFieldElement rawYCoord = base.RawYCoord;
                return((AbstractF2mPoint)curve.CreateRawPoint(rawXCoord.SquarePow(pow), rawYCoord.SquarePow(pow), base.IsCompressed));
            }

            case 1:
            case 6:
            {
                ECFieldElement rawYCoord2     = base.RawYCoord;
                ECFieldElement eCFieldElement = base.RawZCoords[0];
                return((AbstractF2mPoint)curve.CreateRawPoint(rawXCoord.SquarePow(pow), rawYCoord2.SquarePow(pow), new ECFieldElement[]
                    {
                        eCFieldElement.SquarePow(pow)
                    }, base.IsCompressed));
            }
            }
            throw new InvalidOperationException("unsupported coordinate system");
        }
コード例 #3
0
ファイル: ECCurve.cs プロジェクト: zoolooinfosys/bc-csharp
            public virtual ECPoint Lookup(int index)
            {
                int FE_BYTES = (m_outer.FieldSize + 7) / 8;

                byte[] x   = new byte[FE_BYTES], y = new byte[FE_BYTES];
                int    pos = 0;

                for (int i = 0; i < m_size; ++i)
                {
                    byte MASK = (byte)(((i ^ index) - 1) >> 31);

                    for (int j = 0; j < FE_BYTES; ++j)
                    {
                        x[j] ^= (byte)(m_table[pos + j] & MASK);
                        y[j] ^= (byte)(m_table[pos + FE_BYTES + j] & MASK);
                    }

                    pos += (FE_BYTES * 2);
                }

                ECFieldElement X = m_outer.FromBigInteger(new BigInteger(1, x));
                ECFieldElement Y = m_outer.FromBigInteger(new BigInteger(1, y));

                return(m_outer.CreateRawPoint(X, Y, false));
            }
コード例 #4
0
            private ECPoint CreatePoint(byte[] x, byte[] y)
            {
                ECFieldElement X = m_outer.FromBigInteger(new BigInteger(1, x));
                ECFieldElement Y = m_outer.FromBigInteger(new BigInteger(1, y));

                return(m_outer.CreateRawPoint(X, Y, false));
            }