diff --git a/NaCl.net/ArrayExtensions.cs b/NaCl.net/ArrayExtensions.cs new file mode 100644 index 0000000..8a9a632 --- /dev/null +++ b/NaCl.net/ArrayExtensions.cs @@ -0,0 +1,17 @@ +using System; +using System.Runtime.CompilerServices; + +namespace NetMQ.Utils +{ + internal static class ArrayExtensions + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void Clear(this T[] array) + { + if (array != null) + { + Array.Clear(array, 0, array.Length); + } + } + } +} \ No newline at end of file diff --git a/NaCl.net/Internal/StreamSalsa20.cs b/NaCl.net/Internal/StreamSalsa20.cs index 6a3274e..f87b8bd 100644 --- a/NaCl.net/Internal/StreamSalsa20.cs +++ b/NaCl.net/Internal/StreamSalsa20.cs @@ -1,5 +1,6 @@ using System; using System.Runtime.CompilerServices; +using NetMQ.Utils; namespace NaCl.Internal { @@ -48,8 +49,9 @@ static public void Transform(Span c, ReadOnlySpan n, ReadOnlySpan c, ReadOnlySpan m, ReadOnlySpan