using System; using System.Linq; using System.Runtime.CompilerServices; namespace FrostFS.SDK.Cryptography; internal static class ArrayHelper { [MethodImpl(MethodImplOptions.AggressiveInlining)] public static byte[] Concat(params byte[][] buffers) { var length = buffers.Sum(buffer => buffer.Length); var dst = new byte[length]; var p = 0; foreach (var src in buffers) { Buffer.BlockCopy(src, 0, dst, p, src.Length); p += src.Length; } return dst; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void GetRevertedArray(ReadOnlySpan source, byte[] data) { if (source.Length != 0) { int i = 0; int j = source.Length - 1; while (i < source.Length) { data[i++] = source[j--]; } } } }