summary refs log tree commit diff
path: root/crypto/src/math/ec/rfc8032/Codec.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/math/ec/rfc8032/Codec.cs')
-rw-r--r--crypto/src/math/ec/rfc8032/Codec.cs18
1 files changed, 18 insertions, 0 deletions
diff --git a/crypto/src/math/ec/rfc8032/Codec.cs b/crypto/src/math/ec/rfc8032/Codec.cs
index 3aacd12ab..cf1b69b27 100644
--- a/crypto/src/math/ec/rfc8032/Codec.cs
+++ b/crypto/src/math/ec/rfc8032/Codec.cs
@@ -116,6 +116,24 @@ namespace Org.BouncyCastle.Math.EC.Rfc8032
         }
 #endif
 
+        internal static void Encode32(uint[] n, int nOff, int nLen, byte[] bs, int bsOff)
+        {
+            for (int i = 0; i < nLen; ++i)
+            {
+                Encode32(n[nOff + i], bs, bsOff + i * 4);
+            }
+        }
+
+#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER
+        internal static void Encode32(ReadOnlySpan<uint> n, Span<byte> bs)
+        {
+            for (int i = 0; i < n.Length; ++i)
+            {
+                Encode32(n[i], bs[(i * 4)..]);
+            }
+        }
+#endif
+
         internal static void Encode56(ulong n, byte[] bs, int off)
         {
             Encode32((uint)n, bs, off);