Exemplo n.º 1
0
        public static GT Pairing(G1 x, G2 y)
        {
            var res = new GT();

            res.SetPairingOf(x, y);
            return(res);
        }
Exemplo n.º 2
0
 public static GT MillerLoop(G1 x, G2 y)
 {
     unsafe
     {
         GT res;
         MclBls12381.Imports.MclBnMillerLoop.Value(&res, &x, &y);
         return(res);
     }
 }
Exemplo n.º 3
0
 public void SetPairingOf(G1 x, G2 y)
 {
     unsafe
     {
         fixed(GT *ptr = &this)
         {
             MclBls12381.Imports.MclBnPairing.Value(ptr, &x, &y);
         }
     }
 }
Exemplo n.º 4
0
        public static G1 EvaluatePolynomial(G1[] poly, Fr at)
        {
            unsafe
            {
                var res = new G1();

                fixed(G1 *cVec = poly)
                Imports.MclBnG1EvaluatePolynomial.Value(&res, cVec, (ulong)poly.Length, &at);

                return(res);
            }
        }
Exemplo n.º 5
0
        public static G1 LagrangeInterpolate(Fr[] xs, G1[] ys)
        {
            if (xs.Length != ys.Length)
            {
                throw new ArgumentException("arrays are unequal length");
            }
            unsafe
            {
                var res = new G1();

                fixed(Fr *xVec = xs)
                fixed(G1 * yVec = ys)
                Imports.MclBnG1LagrangeInterpolation.Value(&res, xVec, yVec, (ulong)xs.Length);

                return(res);
            }
        }