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

            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.BlsG1Mul(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[2 * BlsParams.LenFp + BlsParams.LenFr];

            inputData.PrepareEthInput(inputDataSpan);

            (byte[], bool)result;

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

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

            return(result);
        }