summary refs log tree commit diff
path: root/crypto/src/math/ec/custom/sec/SecT409Field.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/math/ec/custom/sec/SecT409Field.cs')
-rw-r--r--crypto/src/math/ec/custom/sec/SecT409Field.cs20
1 files changed, 4 insertions, 16 deletions
diff --git a/crypto/src/math/ec/custom/sec/SecT409Field.cs b/crypto/src/math/ec/custom/sec/SecT409Field.cs
index c35d3cef0..0fb7377f6 100644
--- a/crypto/src/math/ec/custom/sec/SecT409Field.cs
+++ b/crypto/src/math/ec/custom/sec/SecT409Field.cs
@@ -191,22 +191,10 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec
 
         public static void Sqrt(ulong[] x, ulong[] z)
         {
-            ulong u0, u1;
-            u0 = Interleave.Unshuffle(x[0]); u1 = Interleave.Unshuffle(x[1]);
-            ulong e0 = (u0 & 0x00000000FFFFFFFFUL) | (u1 << 32);
-            ulong c0 = (u0 >> 32) | (u1 & 0xFFFFFFFF00000000UL);
-
-            u0 = Interleave.Unshuffle(x[2]); u1 = Interleave.Unshuffle(x[3]);
-            ulong e1 = (u0 & 0x00000000FFFFFFFFUL) | (u1 << 32);
-            ulong c1 = (u0 >> 32) | (u1 & 0xFFFFFFFF00000000UL);
-
-            u0 = Interleave.Unshuffle(x[4]); u1 = Interleave.Unshuffle(x[5]);
-            ulong e2 = (u0 & 0x00000000FFFFFFFFUL) | (u1 << 32);
-            ulong c2 = (u0 >> 32) | (u1 & 0xFFFFFFFF00000000UL);
-
-            u0 = Interleave.Unshuffle(x[6]);
-            ulong e3 = (u0 & 0x00000000FFFFFFFFUL);
-            ulong c3 = (u0 >> 32);
+            ulong c0 = Interleave.Unshuffle(x[0], x[1], out ulong e0);
+            ulong c1 = Interleave.Unshuffle(x[2], x[3], out ulong e1);
+            ulong c2 = Interleave.Unshuffle(x[4], x[5], out ulong e2);
+            ulong c3 = Interleave.Unshuffle(x[6]      , out ulong e3);
 
             z[0] = e0 ^ (c0 << 44);
             z[1] = e1 ^ (c1 << 44) ^ (c0 >> 20);