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); }
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); }
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); }