GetMu() public static method

public static GetMu ( F2mCurve curve ) : sbyte
curve F2mCurve
return sbyte
Beispiel #1
0
        public static BigInteger[] GetSi(AbstractF2mCurve curve)
        {
            if (!curve.IsKoblitz)
            {
                throw new ArgumentException("si is defined for Koblitz curves only");
            }
            int   fieldSize         = curve.FieldSize;
            int   intValue          = curve.A.ToBigInteger().IntValue;
            sbyte mu                = Tnaf.GetMu(intValue);
            int   shiftsForCofactor = Tnaf.GetShiftsForCofactor(curve.Cofactor);
            int   k = fieldSize + 3 - intValue;

            BigInteger[] lucas = Tnaf.GetLucas(mu, k, false);
            if (mu == 1)
            {
                lucas[0] = lucas[0].Negate();
                lucas[1] = lucas[1].Negate();
            }
            BigInteger bigInteger  = BigInteger.One.Add(lucas[1]).ShiftRight(shiftsForCofactor);
            BigInteger bigInteger2 = BigInteger.One.Add(lucas[0]).ShiftRight(shiftsForCofactor).Negate();

            return(new BigInteger[]
            {
                bigInteger,
                bigInteger2
            });
        }
Beispiel #2
0
        public static AbstractF2mPoint MultiplyTnaf(AbstractF2mPoint p, ZTauElement lambda)
        {
            AbstractF2mCurve abstractF2mCurve = (AbstractF2mCurve)p.Curve;
            sbyte            mu = Tnaf.GetMu(abstractF2mCurve.A);

            sbyte[] u = Tnaf.TauAdicNaf(mu, lambda);
            return(Tnaf.MultiplyFromTnaf(p, u));
        }
Beispiel #3
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        = Tnaf.GetMu(intValue);

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

            return(Tnaf.MultiplyTnaf(p, lambda));
        }
Beispiel #4
0
        public static BigInteger[] GetSi(int fieldSize, int curveA, BigInteger cofactor)
        {
            sbyte mu = Tnaf.GetMu(curveA);
            int   shiftsForCofactor = Tnaf.GetShiftsForCofactor(cofactor);
            int   k = fieldSize + 3 - curveA;

            BigInteger[] lucas = Tnaf.GetLucas(mu, k, false);
            if (mu == 1)
            {
                lucas[0] = lucas[0].Negate();
                lucas[1] = lucas[1].Negate();
            }
            BigInteger bigInteger  = BigInteger.One.Add(lucas[1]).ShiftRight(shiftsForCofactor);
            BigInteger bigInteger2 = BigInteger.One.Add(lucas[0]).ShiftRight(shiftsForCofactor).Negate();

            return(new BigInteger[]
            {
                bigInteger,
                bigInteger2
            });
        }