diff options
author | David Hook <dgh@cryptoworkshop.com> | 2021-03-19 15:25:57 +1100 |
---|---|---|
committer | David Hook <dgh@cryptoworkshop.com> | 2021-03-19 15:25:57 +1100 |
commit | 504554b718911423f64b9d7235eee6fdba9241ee (patch) | |
tree | c7e41b1a3769b9cfba3dea124f434d551a9c16ed /crypto/src/util/Arrays.cs | |
parent | Add SECURITY.md (diff) | |
download | BouncyCastle.NET-ed25519-504554b718911423f64b9d7235eee6fdba9241ee.tar.xz |
first cut FPE, TupleHash, ParallelHash, and GCM-SIV
Diffstat (limited to 'crypto/src/util/Arrays.cs')
-rw-r--r-- | crypto/src/util/Arrays.cs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/crypto/src/util/Arrays.cs b/crypto/src/util/Arrays.cs index 784d45efb..78c4e8ffc 100644 --- a/crypto/src/util/Arrays.cs +++ b/crypto/src/util/Arrays.cs @@ -467,6 +467,17 @@ namespace Org.BouncyCastle.Utilities return data == null ? null : (byte[])data.Clone(); } + public static short[] Clone(short[] data) + { + return data == null ? null : (short[])data.Clone(); + } + + [CLSCompliantAttribute(false)] + public static ushort[] Clone(ushort[] data) + { + return data == null ? null : (ushort[])data.Clone(); + } + public static int[] Clone(int[] data) { return data == null ? null : (int[])data.Clone(); @@ -694,6 +705,19 @@ namespace Org.BouncyCastle.Utilities return rv; } + public static ushort[] Concatenate(ushort[] a, ushort[] b) + { + if (a == null) + return Clone(b); + if (b == null) + return Clone(a); + + ushort[] rv = new ushort[a.Length + b.Length]; + Array.Copy(a, 0, rv, 0, a.Length); + Array.Copy(b, 0, rv, a.Length, b.Length); + return rv; + } + public static byte[] ConcatenateAll(params byte[][] vs) { byte[][] nonNull = new byte[vs.Length][]; |