summary refs log tree commit diff
path: root/crypto/src/util
diff options
context:
space:
mode:
authorroyb <roy.basmacier@primekey.com>2022-02-03 12:51:52 -0500
committerPeter Dettman <peter.dettman@bouncycastle.org>2022-06-23 21:58:04 +0700
commit004de388d03ebfc6734d4a613f5114ceb8f7a570 (patch)
treec796413a7589c47548c15f35ec4b27f4b17fe6a8 /crypto/src/util
parentNew build organization (diff)
downloadBouncyCastle.NET-ed25519-004de388d03ebfc6734d4a613f5114ceb8f7a570.tar.xz
Initial merge of PQC port
Diffstat (limited to 'crypto/src/util')
-rw-r--r--crypto/src/util/Arrays.cs19
-rw-r--r--crypto/src/util/IEncodable.cs20
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