Example #1
0
        /**
         * Multiplies a {@link BitcoinNet.BouncyCastle.math.ec.AbstractF2mPoint AbstractF2mPoint}
         * by a <code>BigInteger</code> using the reduced <code>&#964;</code>-adic
         * NAF (RTNAF) method.
         * @param p The AbstractF2mPoint to Multiply.
         * @param k The <code>BigInteger</code> by which to Multiply <code>p</code>.
         * @return <code>k * p</code>
         */
        public static AbstractF2mPoint MultiplyRTnaf(AbstractF2mPoint p, BigInteger k)
        {
            AbstractF2mCurve curve = (AbstractF2mCurve)p.Curve;
            int   m  = curve.FieldSize;
            int   a  = curve.A.ToBigInteger().IntValue;
            sbyte mu = GetMu(a);

            BigInteger[] s   = curve.GetSi();
            ZTauElement  rho = PartModReduction(k, m, (sbyte)a, s, mu, (sbyte)10);

            return(MultiplyTnaf(p, rho));
        }
Example #2
0
    public static AbstractF2mPoint MultiplyRTnaf(AbstractF2mPoint p, BigInteger k)
    {
        AbstractF2mCurve abstractF2mCurve = (AbstractF2mCurve)p.Curve;
        int   fieldSize = abstractF2mCurve.FieldSize;
        int   intValue  = abstractF2mCurve.A.ToBigInteger().IntValue;
        sbyte mu        = GetMu(intValue);

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

        return(MultiplyTnaf(p, lambda));
    }
Example #3
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));
        }
Example #4
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));
        }
Example #5
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");
            }

            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, curve.GetPreCompInfo(p, PRECOMP_NAME), a, mu));
        }