コード例 #1
0
ファイル: ECCurve.cs プロジェクト: viruswevh/ObscurCore
        /**
         * Returns the parameter <code>&#956;</code> of the elliptic curve.
         * @return <code>&#956;</code> of the elliptic curve.
         * @throws ArgumentException if the given ECCurve is not a
         * Koblitz curve.
         */
        internal virtual sbyte GetMu()
        {
            if (mu == 0)
            {
                lock (this) {
                    if (mu == 0)
                    {
                        mu = Tnaf.GetMu(this);
                    }
                }
            }

            return(mu);
        }
コード例 #2
0
        /**
         * Returns the parameter <code>&#956;</code> of the elliptic curve.
         * @return <code>&#956;</code> of the elliptic curve.
         * @throws ArgumentException if the given ECCurve is not a
         * Koblitz curve.
         */
        internal sbyte GetMu()
        {
            if (_mu == 0)
            {
                lock (this)
                {
                    if (_mu == 0)
                    {
                        _mu = Tnaf.GetMu(this);
                    }
                }
            }

            return(_mu);
        }
コード例 #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));
        }
コード例 #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));
        }
コード例 #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");
            }

            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));
        }
コード例 #6
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));
        }