예제 #1
0
        private AbstractF2mPoint MultiplyWTnaf(AbstractF2mPoint p, ZTauElement lambda, PreCompInfo preCompInfo, sbyte a, sbyte mu)
        {
            ZTauElement[] alpha = ((a == 0) ? Tnaf.Alpha0 : Tnaf.Alpha1);
            BigInteger    tw    = Tnaf.GetTw(mu, 4);

            sbyte[] u = Tnaf.TauAdicWNaf(mu, lambda, 4, BigInteger.ValueOf(16L), tw, alpha);
            return(MultiplyFromWTnaf(p, u, preCompInfo));
        }
예제 #2
0
        /**
         * Multiplies a {@link org.bouncycastle.math.ec.AbstractF2mPoint AbstractF2mPoint}
         * by an element <code>&#955;</code> of <code><b>Z</b>[&#964;]</code> using
         * the <code>&#964;</code>-adic NAF (TNAF) method.
         * @param p The AbstractF2mPoint to multiply.
         * @param lambda The element <code>&#955;</code> of
         * <code><b>Z</b>[&#964;]</code> of which to compute the
         * <code>[&#964;]</code>-adic NAF.
         * @return <code>p</code> multiplied by <code>&#955;</code>.
         */
        private AbstractF2mPoint MultiplyWTnaf(AbstractF2mPoint p, ZTauElement lambda,
                                               sbyte a, sbyte mu)
        {
            ZTauElement[] alpha = (a == 0) ? Tnaf.Alpha0 : Tnaf.Alpha1;

            BigInteger tw = Tnaf.GetTw(mu, Tnaf.Width);

            sbyte[] u = Tnaf.TauAdicWNaf(mu, lambda, Tnaf.Width,
                                         BigInteger.ValueOf(Tnaf.Pow2Width), tw, alpha);

            return(MultiplyFromWTnaf(p, u));
        }
예제 #3
0
        /**
         * Multiplies a {@link NBitcoin.BouncyCastle.math.ec.AbstractF2mPoint AbstractF2mPoint}
         * by an element
         * <code>&#955;</code>
         * of
         * <code><b>Z</b>[&#964;]</code>
         * using
         * the
         * <code>&#964;</code>
         * -adic NAF (TNAF) method.
         * @param p The AbstractF2mPoint to multiply.
         * @param lambda The element
         * <code>&#955;</code>
         * of
         * <code><b>Z</b>[&#964;]</code>
         * of which to compute the
         * <code>[&#964;]</code>
         * -adic NAF.
         * @return
         * <code>p</code>
         * multiplied by
         * <code>&#955;</code>
         * .
         */
        AbstractF2mPoint MultiplyWTnaf(AbstractF2mPoint p, ZTauElement lambda,
                                       PreCompInfo preCompInfo, sbyte a, sbyte mu)
        {
            var alpha = a == 0 ? Tnaf.Alpha0 : Tnaf.Alpha1;

            var tw = Tnaf.GetTw(mu, Tnaf.Width);

            var u = Tnaf.TauAdicWNaf(mu, lambda, Tnaf.Width,
                                     BigInteger.ValueOf(Tnaf.Pow2Width), tw, alpha);

            return(MultiplyFromWTnaf(p, u, preCompInfo));
        }
예제 #4
0
        /**
         * Multiplies a {@link Al.Security.math.ec.F2mPoint F2mPoint}
         * by an element <code>&#955;</code> of <code><b>Z</b>[&#964;]</code> using
         * the <code>&#964;</code>-adic NAF (TNAF) method.
         * @param p The F2mPoint to multiply.
         * @param lambda The element <code>&#955;</code> of
         * <code><b>Z</b>[&#964;]</code> of which to compute the
         * <code>[&#964;]</code>-adic NAF.
         * @return <code>p</code> multiplied by <code>&#955;</code>.
         */
        private F2mPoint MultiplyWTnaf(F2mPoint p, ZTauElement lambda,
                                       PreCompInfo preCompInfo, sbyte a, sbyte mu)
        {
            ZTauElement[] alpha;
            if (a == 0)
            {
                alpha = Tnaf.Alpha0;
            }
            else
            {
                // a == 1
                alpha = Tnaf.Alpha1;
            }

            BigInteger tw = Tnaf.GetTw(mu, Tnaf.Width);

            sbyte[] u = Tnaf.TauAdicWNaf(mu, lambda, Tnaf.Width,
                                         BigInteger.ValueOf(Tnaf.Pow2Width), tw, alpha);

            return(MultiplyFromWTnaf(p, u, preCompInfo));
        }