예제 #1
0
        public static void secp256k1_ecmult_gen(EcmultGenContext ctx, out GeJ r, Scalar gn)
        {
            Ge        ge        = new Ge();
            GeStorage geStorage = new GeStorage();

            r = ctx.Initial.Clone();
            Scalar r1 = new Scalar();

            Scalar.Add(r1, gn, ctx.Blind);
            ge.Infinity = false;
            for (int index1 = 0; index1 < 64; ++index1)
            {
                uint bits = r1.GetBits(index1 * 4, 4);
                for (int index2 = 0; index2 < 16; ++index2)
                {
                    Group.StorageCmov(geStorage, ctx.Prec[index1][index2], (long)index2 == (long)bits);
                }
                Group.FromStorage(ge, geStorage);
                Group.GeJAddGe(r, r, ge);
            }
            Group.secp256k1_ge_clear(ge);
            Scalar.Clear(r1);
        }