Exemplo n.º 1
0
        public (byte[], bool) Run(byte[] inputData, IReleaseSpec releaseSpec)
        {
            const int expectedInputLength = 4 * BlsParams.LenFp;

            if (inputData.Length != expectedInputLength)
            {
                return(Array.Empty <byte>(), false);
            }

            // Span<byte> inputDataSpan = stackalloc byte[expectedInputLength];
            // inputData.PrepareEthInput(inputDataSpan);

            (byte[], bool)result;

            Span <byte> output  = stackalloc byte[2 * BlsParams.LenFp];
            bool        success = ShamatarLib.BlsG1Add(inputData, output);

            if (success)
            {
                result = (output.ToArray(), true);
            }
            else
            {
                result = (Array.Empty <byte>(), false);
            }

            return(result);
        }
Exemplo n.º 2
0
        public (byte[], bool) Run(byte[] inputData)
        {
            Span <byte> inputDataSpan = stackalloc byte[4 * BlsParams.LenFp];

            inputData.PrepareEthInput(inputDataSpan);

            (byte[], bool)result;

            Span <byte> output  = stackalloc byte[2 * BlsParams.LenFp];
            bool        success = ShamatarLib.BlsG1Add(inputDataSpan, output);

            if (success)
            {
                result = (output.ToArray(), true);
            }
            else
            {
                result = (Bytes.Empty, false);
            }

            return(result);
        }