From 8c26eb74872ff8d6f6acdeca0b8164449b6d05a7 Mon Sep 17 00:00:00 2001 From: David Hook Date: Mon, 16 Nov 2015 10:19:54 +1100 Subject: added 4[] Concatenate --- crypto/src/util/Arrays.cs | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/crypto/src/util/Arrays.cs b/crypto/src/util/Arrays.cs index 6be94c543..32c56b8b5 100644 --- a/crypto/src/util/Arrays.cs +++ b/crypto/src/util/Arrays.cs @@ -613,6 +613,37 @@ namespace Org.BouncyCastle.Utilities } } + public static byte[] Concatenate(byte[] a, byte[] b, byte[] c, byte[] d) + { + if (a != null && b != null && c != null && d != null) + { + byte[] rv = new byte[a.Length + b.Length + c.Length + d.Length]; + + Array.Copy(a, 0, rv, 0, a.Length); + Array.Copy(b, 0, rv, a.Length, b.Length); + Array.Copy(c, 0, rv, a.Length + b.Length, c.Length); + Array.Copy(d, 0, rv, a.Length + b.Length + c.Length, d.Length); + + return rv; + } + else if (d == null) + { + return Concatenate(a, b, c); + } + else if (c == null) + { + return Concatenate(a, b, d); + } + else if (b == null) + { + return Concatenate(a, c, d); + } + else + { + return Concatenate(b, c, d); + } + } + public static int[] Concatenate(int[] a, int[] b) { if (a == null) -- cgit 1.4.1