예제 #1
0
        public static void secp256k1_ecmult_context_build(EcMultContext ctx, EventHandler <Callback> cb)
        {
            if (ctx.PreG != null)
            {
                return;
            }
            GeJ geJ = new GeJ();

            Group.secp256k1_gej_set_ge(geJ, Group.Secp256K1GeConstG);
            int n = 1 << 16 - 2;

            ctx.PreG = new GeStorage[n];
            for (int index = 0; index < n; ++index)
            {
                ctx.PreG[index] = new GeStorage();
            }
            EcMult.secp256k1_ecmult_odd_multiples_table_storage_var(n, ctx.PreG, geJ, cb);
        }
예제 #2
0
 public static void secp256k1_ecmult_odd_multiples_table_storage_var(int n, GeStorage[] pre, GeJ a, EventHandler <Callback> cb)
 {
     GeJ[] geJArray = new GeJ[n];
     Ge[]  r        = new Ge[n];
     Fe[]  zr       = new Fe[n];
     for (int index = 0; index < n; ++index)
     {
         geJArray[index] = new GeJ();
         r[index]        = new Ge();
         zr[index]       = new Fe();
     }
     EcMult.secp256k1_ecmult_odd_multiples_table(n, geJArray, zr, a);
     Group.secp256k1_ge_set_table_gej_var(r, geJArray, zr, n);
     for (int index = 0; index < n; ++index)
     {
         Group.ToStorage(pre[index], r[index]);
     }
 }