Пример #1
0
        public static void ToStorage(GeStorage r, Ge a)
        {
            var fe1 = a.X.Clone();

            Field.Normalize(fe1);
            var fe2 = a.Y.Clone();

            Field.Normalize(fe2);
            Field.ToStorage(r.X, fe1);
            Field.ToStorage(r.Y, fe2);
        }
Пример #2
0
        public static void secp256k1_ecmult_gen(EcmultGenContext ctx, out GeJ r, Scalar gn)
        {
            var ge        = new Ge();
            var geStorage = new GeStorage();

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

            Scalar.Add(r1, gn, ctx.Blind);
            ge.Infinity = false;
            for (var index1 = 0; index1 < 64; ++index1)
            {
                var bits = r1.GetBits(index1 * 4, 4);
                for (var 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);
        }
Пример #3
0
 public static void StorageCmov(GeStorage r, GeStorage a, bool flag)
 {
     Field.StorageCmov(r.X, a.X, flag);
     Field.StorageCmov(r.Y, a.Y, flag);
 }
Пример #4
0
 public static void FromStorage(Ge r, GeStorage a)
 {
     Field.FromStorage(r.X, a.X);
     Field.FromStorage(r.Y, a.Y);
     r.Infinity = false;
 }