public (byte[], bool) Run(byte[] inputData)
        {
            if (inputData == null)
            {
                inputData = Bytes.Empty;
            }

            // fail if input len is not a multiple of PAIR_SIZE
            if (inputData.Length % PairSize > 0)
            {
                return(Bytes.Empty, false);
            }

            PairingCheck check = PairingCheck.Create();

            // iterating over all pairs
            for (int offset = 0; offset < inputData.Length; offset += PairSize)
            {
                (Bn128Fp, Bn128Fp2)pair = DecodePair(inputData, offset);

                // fail if decoding has failed
                if (pair.Item1 == null || pair.Item2 == null)
                {
                    return(Bytes.Empty, false);
                }

                check.AddPair(pair.Item1, pair.Item2);
            }

            check.Run();
            BigInteger result = check.Result();

            return(result.ToBigEndianByteArray(32), true);
        }
            public override KeyValuePair <bool, byte[]> Execute(byte[] data)
            {
                if (data == null)
                {
                    data = new byte[0];
                }

                if (data.Length % PAIR_SIZE > 0)
                {
                    return(new KeyValuePair <bool, byte[]>(false, new byte[0]));
                }

                PairingCheck check = PairingCheck.Create();

                // iterating over all pairs
                for (int offset = 0; offset < data.Length; offset += PAIR_SIZE)
                {
                    KeyValuePair <BN128G1, BN128G2> pair = DecodePair(data, offset);

                    if (pair.Equals(default(KeyValuePair <BN128G1, BN128G2>)))
                    {
                        return(new KeyValuePair <bool, byte[]>(false, new byte[0]));
                    }

                    check.AddPair(pair.Key, pair.Value);
                }

                check.Run();
                int result = check.Result();

                return(new KeyValuePair <bool, byte[]>(true, new DataWord(result).Data));
            }