Exemple #1
0
        /// <summary>
        /// millerov agoritam
        /// </summary>
        /// <param name="a">točka</param>
        /// <param name="b">točka</param>
        /// <param name="m">red grupe</param>
        /// <param name="p">red polja, prim</param>
        /// <returns></returns>
        private static BigInteger Miller(FpPoint P, FpPoint Q, BigInteger m, BigInteger prim)
        {
            // Millerov algoritam

            string mBin = m.ToString(2);

            BigInteger t1 = new BigInteger("1", 10);
            BigInteger t2 = new BigInteger("1", 10);
            FpPoint    V  = P;

            for (int i = 0; i < m.BitLength; i++)
            {
                V  = (FpPoint)V.Twice();
                t1 = t1.ModPow(new BigInteger("2", 10), prim).Multiply(MLF(V, V, Q));
                if (mBin[i] == '1')
                {
                    t1 = t1.Multiply(MLF(V, P, Q));
                    V  = (FpPoint)V.Add(P);
                }
            }
            return(t1);
        }
Exemple #2
0
 public override GroupElement Multiply(GroupElement other)
 {
     return(new ECElement(point.Add((other as ECElement).point) as FpPoint));
 }