<PackageReference Include="BouncyCastle.Cryptography" Version="2.5.0" />

Spans

static class Spans
using System; using System.Runtime.CompilerServices; namespace Org.BouncyCastle.Utilities { [System.Runtime.CompilerServices.NullableContext(2)] [System.Runtime.CompilerServices.Nullable(0)] internal static class Spans { [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static void CopyFrom<T>([System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1 })] this Span<T> output, [System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1 })] ReadOnlySpan<T> input) { input.Slice(0, output.Length).CopyTo(output); } [MethodImpl(MethodImplOptions.AggressiveInlining)] [return: System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1 })] internal static Span<T> FromNullable<T>([System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1 })] T[] array) { return array?.AsSpan() ?? Span<T>.Empty; } [MethodImpl(MethodImplOptions.AggressiveInlining)] [return: System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1 })] internal static Span<T> FromNullable<T>([System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1 })] T[] array, int start) { return array?.AsSpan(start) ?? Span<T>.Empty; } [MethodImpl(MethodImplOptions.AggressiveInlining)] [return: System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1 })] internal static ReadOnlySpan<T> FromNullableReadOnly<T>([System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1 })] T[] array) { return array?.AsSpan() ?? Span<T>.Empty; } [MethodImpl(MethodImplOptions.AggressiveInlining)] [return: System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1 })] internal static ReadOnlySpan<T> FromNullableReadOnly<T>([System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1 })] T[] array, int start) { return array?.AsSpan(start) ?? Span<T>.Empty; } } }