summary refs log tree commit diff
path: root/crypto/src/math/ec/custom/sec/Nat224.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2014-03-04 11:12:43 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2014-03-04 11:12:43 +0700
commitecf5397a6edbe46248ef74a782e7443e4f5341c5 (patch)
treeadd85103823cd9edef723854e8215f396ca6123e /crypto/src/math/ec/custom/sec/Nat224.cs
parentRefactoring in the Nat* classes and some new method variations (diff)
downloadBouncyCastle.NET-ed25519-ecf5397a6edbe46248ef74a782e7443e4f5341c5.tar.xz
Just use shift methods from Nat class evverywhere
Diffstat (limited to 'crypto/src/math/ec/custom/sec/Nat224.cs')
-rw-r--r--crypto/src/math/ec/custom/sec/Nat224.cs86
1 files changed, 2 insertions, 84 deletions
diff --git a/crypto/src/math/ec/custom/sec/Nat224.cs b/crypto/src/math/ec/custom/sec/Nat224.cs
index 9ea85cba2..7027f1162 100644
--- a/crypto/src/math/ec/custom/sec/Nat224.cs
+++ b/crypto/src/math/ec/custom/sec/Nat224.cs
@@ -856,88 +856,6 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec
             return (uint)c;
         }
 
-        public static uint ShiftDownBit(uint[] x, int xLen, uint c)
-        {
-            int i = xLen;
-            while (--i >= 0)
-            {
-                uint next = x[i];
-                x[i] = (next >> 1) | (c << 31);
-                c = next;
-            }
-            return c << 31;
-        }
-
-        public static uint ShiftDownBit(uint[] x, uint c, uint[] z)
-        {
-            int i = 7;
-            while (--i >= 0)
-            {
-                uint next = x[i];
-                z[i] = (next >> 1) | (c << 31);
-                c = next;
-            }
-            return c << 31;
-        }
-
-        public static uint ShiftDownBits(uint[] x, int xLen, int bits, uint c)
-        {
-            Debug.Assert(bits > 0 && bits < 32);
-            int i = xLen;
-            while (--i >= 0)
-            {
-                uint next = x[i];
-                x[i] = (next >> bits) | (c << -bits);
-                c = next;
-            }
-            return c << -bits;
-        }
-
-        public static uint ShiftDownWord(uint[] x, int xLen, uint c)
-        {
-            int i = xLen;
-            while (--i >= 0)
-            {
-                uint next = x[i];
-                x[i] = c;
-                c = next;
-            }
-            return c;
-        }
-
-        public static uint ShiftUpBit(uint[] x, int xLen, uint c)
-        {
-            for (int i = 0; i < xLen; ++i)
-            {
-                uint next = x[i];
-                x[i] = (next << 1) | (c >> 31);
-                c = next;
-            }
-            return c >> 31;
-        }
-
-        public static uint ShiftUpBit(uint[] x, int xOff, int xLen, uint c)
-        {
-            for (int i = 0; i < xLen; ++i)
-            {
-                uint next = x[xOff + i];
-                x[xOff + i] = (next << 1) | (c >> 31);
-                c = next;
-            }
-            return c >> 31;
-        }
-
-        public static uint ShiftUpBit(uint[] x, uint c, uint[] z)
-        {
-            for (int i = 0; i < 7; ++i)
-            {
-                uint next = x[i];
-                z[i] = (next << 1) | (c >> 31);
-                c = next;
-            }
-            return c >> 31;
-        }
-
         public static void Square(uint[] x, uint[] zz)
         {
             ulong x_0 = x[0];
@@ -1050,7 +968,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec
             zz[12] = (uint)zz_12;
             zz[13] += (uint)(zz_12 >> 32);
 
-            ShiftUpBit(zz, 14, (uint)x_0 << 31);
+            Nat.ShiftUpBit(14, zz, (uint)x_0 << 31);
         }
 
         public static void Square(uint[] x, int xOff, uint[] zz, int zzOff)
@@ -1165,7 +1083,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec
             zz[zzOff + 12] = (uint)zz_12;
             zz[zzOff + 13] += (uint)(zz_12 >> 32);
 
-            ShiftUpBit(zz, zzOff, 16, (uint)x_0 << 31);
+            Nat.ShiftUpBit(14, zz, zzOff, (uint)x_0 << 31);
         }
 
         public static int Sub(uint[] x, uint[] y, uint[] z)