コード例 #1
0
        protected override ECPoint MultiplyPositive(ECPoint point, BigInteger k)
        {
            if (!(point is AbstractF2mPoint))
            {
                throw new ArgumentException("Only AbstractF2mPoint can be used in WTauNafMultiplier");
            }
            AbstractF2mPoint p     = (AbstractF2mPoint)point;
            AbstractF2mCurve curve = (AbstractF2mCurve)p.Curve;
            int   fieldSize        = curve.FieldSize;
            sbyte intValue         = (sbyte)curve.A.ToBigInteger().IntValue;
            sbyte mu = Tnaf.GetMu((int)intValue);

            BigInteger[] si     = curve.GetSi();
            ZTauElement  lambda = Tnaf.PartModReduction(k, fieldSize, intValue, si, mu, 10);

            return(this.MultiplyWTnaf(p, lambda, curve.GetPreCompInfo(p, PRECOMP_NAME), intValue, mu));
        }
コード例 #2
0
        protected override ECPoint MultiplyPositive(ECPoint point, BigInteger k)
        {
            //IL_000d: Unknown result type (might be due to invalid IL or missing references)
            if (!(point is AbstractF2mPoint))
            {
                throw new ArgumentException("Only AbstractF2mPoint can be used in WTauNafMultiplier");
            }
            AbstractF2mPoint abstractF2mPoint = (AbstractF2mPoint)point;
            AbstractF2mCurve abstractF2mCurve = (AbstractF2mCurve)abstractF2mPoint.Curve;
            int   fieldSize = abstractF2mCurve.FieldSize;
            sbyte b         = (sbyte)abstractF2mCurve.A.ToBigInteger().IntValue;
            sbyte mu        = Tnaf.GetMu(b);

            BigInteger[] si     = abstractF2mCurve.GetSi();
            ZTauElement  lambda = Tnaf.PartModReduction(k, fieldSize, b, si, mu, 10);

            return(MultiplyWTnaf(abstractF2mPoint, lambda, abstractF2mCurve.GetPreCompInfo(abstractF2mPoint, PRECOMP_NAME), b, mu));
        }
コード例 #3
0
        /**
         * Multiplies a {@link NBitcoin.BouncyCastle.math.ec.AbstractF2mPoint AbstractF2mPoint}
         * by
         * <code>k</code>
         * using the reduced
         * <code>&#964;</code>
         * -adic NAF (RTNAF)
         * method.
         * @param p The AbstractF2mPoint to multiply.
         * @param k The integer by which to multiply
         * <code>k</code>
         * .
         * @return
         * <code>p</code>
         * multiplied by
         * <code>k</code>
         * .
         */
        protected override ECPoint MultiplyPositive(ECPoint point, BigInteger k)
        {
            if (!(point is AbstractF2mPoint))
            {
                throw new ArgumentException("Only AbstractF2mPoint can be used in WTauNafMultiplier");
            }

            var p     = (AbstractF2mPoint)point;
            var curve = (AbstractF2mCurve)p.Curve;
            var m     = curve.FieldSize;
            var a     = (sbyte)curve.A.ToBigInteger().IntValue;
            var mu    = Tnaf.GetMu(a);
            var s     = curve.GetSi();

            var rho = Tnaf.PartModReduction(k, m, a, s, mu, 10);

            return(MultiplyWTnaf(p, rho, curve.GetPreCompInfo(p, PRECOMP_NAME), a, mu));
        }
コード例 #4
0
        /**
         * Multiplies a {@link org.bouncycastle.math.ec.AbstractF2mPoint AbstractF2mPoint}
         * by <code>k</code> using the reduced <code>&#964;</code>-adic NAF (RTNAF)
         * method.
         * @param p The AbstractF2mPoint to multiply.
         * @param k The integer by which to multiply <code>k</code>.
         * @return <code>p</code> multiplied by <code>k</code>.
         */
        protected override ECPoint MultiplyPositive(ECPoint point, BigInteger k)
        {
            if (!(point is AbstractF2mPoint))
            {
                throw new ArgumentException("Only AbstractF2mPoint can be used in WTauNafMultiplier");
            }

            AbstractF2mPoint p     = (AbstractF2mPoint)point;
            AbstractF2mCurve curve = (AbstractF2mCurve)p.Curve;
            int   m  = curve.FieldSize;
            sbyte a  = (sbyte)curve.A.ToBigInteger().IntValue;
            sbyte mu = Tnaf.GetMu(a);

            BigInteger[] s = curve.GetSi();

            ZTauElement rho = Tnaf.PartModReduction(k, m, a, s, mu, (sbyte)10);

            return(MultiplyWTnaf(p, rho, a, mu));
        }
コード例 #5
0
        /**
         * Multiplies a {@link org.bouncycastle.math.ec.F2mPoint F2mPoint}
         * by <code>k</code> using the reduced <code>&#964;</code>-adic NAF (RTNAF)
         * method.
         * @param p The F2mPoint to multiply.
         * @param k The integer by which to multiply <code>k</code>.
         * @return <code>p</code> multiplied by <code>k</code>.
         */
        protected override ECPoint MultiplyPositive(ECPoint point, BigInteger k)
        {
            if (!(point is F2mPoint))
            {
                throw new ArgumentException("Only F2mPoint can be used in WTauNafMultiplier");
            }

            F2mPoint p     = (F2mPoint)point;
            F2mCurve curve = (F2mCurve)p.Curve;
            int      m     = curve.M;
            sbyte    a     = (sbyte)curve.A.ToBigInteger().IntValue;
            sbyte    mu    = curve.GetMu();

            BigInteger[] s = curve.GetSi();

            ZTauElement rho = Tnaf.PartModReduction(k, m, a, s, mu, (sbyte)10);

            return(MultiplyWTnaf(p, rho, curve.GetPreCompInfo(p, PRECOMP_NAME), a, mu));
        }
コード例 #6
0
        /**
         * Multiplies a {@link Al.Security.math.ec.F2mPoint F2mPoint}
         * by <code>k</code> using the reduced <code>&#964;</code>-adic NAF (RTNAF)
         * method.
         * @param p The F2mPoint to multiply.
         * @param k The integer by which to multiply <code>k</code>.
         * @return <code>p</code> multiplied by <code>k</code>.
         */
        public ECPoint Multiply(ECPoint point, BigInteger k, PreCompInfo preCompInfo)
        {
            if (!(point is F2mPoint))
            {
                throw new ArgumentException("Only F2mPoint can be used in WTauNafMultiplier");
            }

            F2mPoint p = (F2mPoint)point;

            F2mCurve curve = (F2mCurve)p.Curve;
            int      m     = curve.M;
            sbyte    a     = (sbyte)curve.A.ToBigInteger().IntValue;
            sbyte    mu    = curve.GetMu();

            BigInteger[] s = curve.GetSi();

            ZTauElement rho = Tnaf.PartModReduction(k, m, a, s, mu, (sbyte)10);

            return(MultiplyWTnaf(p, rho, preCompInfo, a, mu));
        }