diff options
author | royb <roy.basmacier@primekey.com> | 2022-02-03 12:51:52 -0500 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-06-23 21:58:04 +0700 |
commit | 004de388d03ebfc6734d4a613f5114ceb8f7a570 (patch) | |
tree | c796413a7589c47548c15f35ec4b27f4b17fe6a8 /crypto/src/util/Arrays.cs | |
parent | New build organization (diff) | |
download | BouncyCastle.NET-ed25519-004de388d03ebfc6734d4a613f5114ceb8f7a570.tar.xz |
Initial merge of PQC port
Diffstat (limited to 'crypto/src/util/Arrays.cs')
-rw-r--r-- | crypto/src/util/Arrays.cs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/crypto/src/util/Arrays.cs b/crypto/src/util/Arrays.cs index b206d3144..d7227df2b 100644 --- a/crypto/src/util/Arrays.cs +++ b/crypto/src/util/Arrays.cs @@ -600,6 +600,12 @@ namespace Org.BouncyCastle.Utilities Array.Copy(data, 0, tmp, 0, System.Math.Min(newLength, data.Length)); return tmp; } + public static uint[] CopyOf(uint[] data, int newLength) + { + uint[] tmp = new uint[newLength]; + Array.Copy(data, 0, tmp, 0, System.Math.Min(newLength, data.Length)); + return tmp; + } public static long[] CopyOf(long[] data, int newLength) { @@ -770,6 +776,19 @@ namespace Org.BouncyCastle.Utilities Array.Copy(b, 0, rv, a.Length, b.Length); return rv; } + + public static uint[] Concatenate(uint[] a, uint[] b) + { + if (a == null) + return Clone(b); + if (b == null) + return Clone(a); + + uint[] rv = new uint[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[] Prepend(byte[] a, byte b) { |