summary refs log tree commit diff
path: root/crypto/src/math/ec/custom/sec/SecT571Field.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2022-07-18 14:04:40 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2022-07-18 14:04:40 +0700
commit2a27035daa92bb2fc1c89914481db58e9336d35e (patch)
tree84737dbc459344c32878722e1787fe097e766f62 /crypto/src/math/ec/custom/sec/SecT571Field.cs
parentLongArray cleanup and refactoring (diff)
downloadBouncyCastle.NET-ed25519-2a27035daa92bb2fc1c89914481db58e9336d35e.tar.xz
Factor out Unshuffle methods
Diffstat (limited to 'crypto/src/math/ec/custom/sec/SecT571Field.cs')
-rw-r--r--crypto/src/math/ec/custom/sec/SecT571Field.cs18
1 files changed, 5 insertions, 13 deletions
diff --git a/crypto/src/math/ec/custom/sec/SecT571Field.cs b/crypto/src/math/ec/custom/sec/SecT571Field.cs
index 1b8bb763e..4d3f715fa 100644
--- a/crypto/src/math/ec/custom/sec/SecT571Field.cs
+++ b/crypto/src/math/ec/custom/sec/SecT571Field.cs
@@ -231,19 +231,11 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec
         {
             ulong[] evn = Nat576.Create64(), odd = Nat576.Create64();
 
-            int pos = 0;
-            for (int i = 0; i < 4; ++i)
-            {
-                ulong u0 = Interleave.Unshuffle(x[pos++]);
-                ulong u1 = Interleave.Unshuffle(x[pos++]);
-                evn[i] = (u0 & 0x00000000FFFFFFFFUL) | (u1 << 32);
-                odd[i] = (u0 >> 32) | (u1 & 0xFFFFFFFF00000000UL);
-            }
-            {
-                ulong u0 = Interleave.Unshuffle(x[pos]);
-                evn[4] = (u0 & 0x00000000FFFFFFFFUL);
-                odd[4] = (u0 >> 32);
-            }
+            odd[0] = Interleave.Unshuffle(x[0], x[1], out evn[0]);
+            odd[1] = Interleave.Unshuffle(x[2], x[3], out evn[1]);
+            odd[2] = Interleave.Unshuffle(x[4], x[5], out evn[2]);
+            odd[3] = Interleave.Unshuffle(x[6], x[7], out evn[3]);
+            odd[4] = Interleave.Unshuffle(x[8]      , out evn[4]);
 
             Multiply(odd, ROOT_Z, z);
             Add(z, evn, z);