예제 #1
0
        public (byte[], bool) Run(byte[] inputData)
        {
            inputData ??= Bytes.Empty;
            if (inputData.Length % ItemSize > 0)
            {
                // note that it will not happen in case of null / 0 length
                return(Bytes.Empty, false);
            }

            (byte[], bool)result;

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

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

            return(result);
        }
예제 #2
0
        public (ReadOnlyMemory <byte>, bool) Run(ReadOnlyMemory <byte> inputData, IReleaseSpec releaseSpec)
        {
            if (inputData.Length % ItemSize > 0 || inputData.Length == 0)
            {
                return(Array.Empty <byte>(), false);
            }

            (byte[], bool)result;

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

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

            return(result);
        }
예제 #3
0
        public (byte[], bool) Run(byte[] inputData)
        {
            inputData ??= Array.Empty <byte>();
            if (inputData.Length % ItemSize > 0 || inputData.Length == 0)
            {
                return(Array.Empty <byte>(), false);
            }

            (byte[], bool)result;

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

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

            return(result);
        }