diff options
Diffstat (limited to 'crypto/src/util')
-rw-r--r-- | crypto/src/util/Arrays.cs | 19 | ||||
-rw-r--r-- | crypto/src/util/IEncodable.cs | 20 |
2 files changed, 39 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) { diff --git a/crypto/src/util/IEncodable.cs b/crypto/src/util/IEncodable.cs new file mode 100644 index 000000000..29d5af7f8 --- /dev/null +++ b/crypto/src/util/IEncodable.cs @@ -0,0 +1,20 @@ +using System.IO; + +namespace Org.BouncyCastle.Utilities +{ + public interface IEncodable + { + ///<summary> + /// + /// + /// + /// + /// + // * Return a byte array representing the implementing object. + // * + // * @return a byte array representing the encoding. + // * @throws IOException if an issue arises generation the encoding. + // */ + byte[] GetEncoded(); + } +} \ No newline at end of file |