public static void ContextBuild(EcmultGenContext ctx, EventHandler <Callback> cb) { var r1 = new Ge[1024]; var r2 = new GeJ(); var geJ1 = new GeJ(); if (ctx.Prec != null) { return; } ctx.PrecInit(); Group.secp256k1_gej_set_ge(r2, Group.Secp256K1GeConstG); var bytes = Encoding.UTF8.GetBytes("The scalar for this x is unknown"); var fe = new Fe(); var ge = new Ge(); Field.SetB32(fe, bytes); Group.secp256k1_ge_set_xo_var(ge, fe, false); Group.secp256k1_gej_set_ge(geJ1, ge); Group.secp256k1_gej_add_ge_var(geJ1, geJ1, Group.Secp256K1GeConstG, (Fe)null); var a = new GeJ[1024]; for (var index = 0; index < a.Length; ++index) { a[index] = new GeJ(); } var geJ2 = r2.Clone(); var geJ3 = geJ1.Clone(); for (var index1 = 0; index1 < 64; ++index1) { a[index1 * 16] = geJ3.Clone(); for (var index2 = 1; index2 < 16; ++index2) { Group.secp256k1_gej_add_var(a[index1 * 16 + index2], a[index1 * 16 + index2 - 1], geJ2, (Fe)null); } for (var index2 = 0; index2 < 4; ++index2) { Group.secp256k1_gej_double_var(geJ2, geJ2, (Fe)null); } Group.secp256k1_gej_double_var(geJ3, geJ3, (Fe)null); if (index1 == 62) { Group.secp256k1_gej_neg(geJ3, geJ3); Group.secp256k1_gej_add_var(geJ3, geJ3, geJ1, (Fe)null); } } for (var index = 0; index < r1.Length; ++index) { r1[index] = new Ge(); } Group.secp256k1_ge_set_all_gej_var(r1, a, 1024, cb); for (var index1 = 0; index1 < 64; ++index1) { for (var index2 = 0; index2 < 16; ++index2) { Group.ToStorage(ctx.Prec[index1][index2], r1[index1 * 16 + index2]); } } EcMultGen.Blind(ctx, (byte[])null); }