diff options
author | David Hook <dgh@cryptoworkshop.com> | 2015-11-16 10:19:54 +1100 |
---|---|---|
committer | David Hook <dgh@cryptoworkshop.com> | 2015-11-16 10:19:54 +1100 |
commit | 8c26eb74872ff8d6f6acdeca0b8164449b6d05a7 (patch) | |
tree | 0098a71e36eff2691795fdd33a6876cb2d70d147 | |
parent | added 3[] Concatenate (diff) | |
download | BouncyCastle.NET-ed25519-8c26eb74872ff8d6f6acdeca0b8164449b6d05a7.tar.xz |
added 4[] Concatenate
-rw-r--r-- | crypto/src/util/Arrays.cs | 31 |
1 files changed, 31 insertions, 0 deletions
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) |