summary refs log tree commit diff
path: root/crypto/src/math/ec/rfc7748
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2022-11-25 19:12:01 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2022-11-25 19:12:01 +0700
commitdf0e0d95e952954d9c9b8588372b1f194bf329ce (patch)
treeac34a878cc1c31e9744b0d2aff468ab4d4442d56 /crypto/src/math/ec/rfc7748
parentEd25519: cofactored verification (diff)
downloadBouncyCastle.NET-ed25519-df0e0d95e952954d9c9b8588372b1f194bf329ce.tar.xz
Ed448: cofactored verification
- Perf. opts.: Pornin's basis reduction
- factor out Scalar448 class
- factor out ScalarUtilities class
Diffstat (limited to 'crypto/src/math/ec/rfc7748')
-rw-r--r--crypto/src/math/ec/rfc7748/X448Field.cs24
1 files changed, 24 insertions, 0 deletions
diff --git a/crypto/src/math/ec/rfc7748/X448Field.cs b/crypto/src/math/ec/rfc7748/X448Field.cs
index 1df837d3a..7169bd6d8 100644
--- a/crypto/src/math/ec/rfc7748/X448Field.cs
+++ b/crypto/src/math/ec/rfc7748/X448Field.cs
@@ -241,6 +241,18 @@ namespace Org.BouncyCastle.Math.EC.Rfc7748
         }
 #endif
 
+        public static void Decode(byte[] x, uint[] z)
+        {
+            Decode56(x, 0, z, 0);
+            Decode56(x, 7, z, 2);
+            Decode56(x, 14, z, 4);
+            Decode56(x, 21, z, 6);
+            Decode56(x, 28, z, 8);
+            Decode56(x, 35, z, 10);
+            Decode56(x, 42, z, 12);
+            Decode56(x, 49, z, 14);
+        }
+
         public static void Decode(byte[] x, int xOff, uint[] z)
         {
             Decode56(x, xOff, z, 0);
@@ -369,6 +381,18 @@ namespace Org.BouncyCastle.Math.EC.Rfc7748
         }
 #endif
 
+        public static void Encode(uint[] x, byte[] z)
+        {
+            Encode56(x, 0, z, 0);
+            Encode56(x, 2, z, 7);
+            Encode56(x, 4, z, 14);
+            Encode56(x, 6, z, 21);
+            Encode56(x, 8, z, 28);
+            Encode56(x, 10, z, 35);
+            Encode56(x, 12, z, 42);
+            Encode56(x, 14, z, 49);
+        }
+
         public static void Encode(uint[] x, byte[] z, int zOff)
         {
             Encode56(x, 0, z, zOff);