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

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

            ctx.PreG = new GeStorage[n];
            for (var 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)
        {
            var geJArray = new GeJ[n];
            var r        = new Ge[n];
            var zr       = new Fe[n];

            for (var 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 (var index = 0; index < n; ++index)
            {
                Group.ToStorage(pre[index], r[index]);
            }
        }