public static void ToStorage(GeStorage r, Ge a) { Fe fe1 = a.X.Clone(); Field.Normalize(fe1); Fe fe2 = a.Y.Clone(); Field.Normalize(fe2); Field.ToStorage(r.X, fe1); Field.ToStorage(r.Y, fe2); }
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); }
public static void StorageCmov(GeStorage r, GeStorage a, bool flag) { Field.StorageCmov(r.X, a.X, flag); Field.StorageCmov(r.Y, a.Y, flag); }
public static void FromStorage(Ge r, GeStorage a) { Field.FromStorage(r.X, a.X); Field.FromStorage(r.Y, a.Y); r.Infinity = false; }