diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2013-10-09 06:15:56 +0400 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2013-10-09 06:15:56 +0400 |
commit | 510a1bcb05f16883eb887ab52d47e55417d18c69 (patch) | |
tree | 14201adba7dbec1e8ec5ca356ad0758ee7857033 /core | |
parent | 76dd8578f9a356c2f70f695b1587e218b18298e5 (diff) |
Improve table-building for Lopez-Dahab multiplication
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/java/org/bouncycastle/math/ec/LongArray.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/core/src/main/java/org/bouncycastle/math/ec/LongArray.java b/core/src/main/java/org/bouncycastle/math/ec/LongArray.java index 08401a07..3b865347 100644 --- a/core/src/main/java/org/bouncycastle/math/ec/LongArray.java +++ b/core/src/main/java/org/bouncycastle/math/ec/LongArray.java @@ -690,6 +690,14 @@ class LongArray } } + private static void add(long[] x, int xOff, long[] y, int yOff, long[] z, int zOff, int count) + { + for (int i = 0; i < count; ++i) + { + z[zOff + i] = x[xOff + i] ^ y[yOff + i]; + } + } + private static void distribute(long[] x, int src, int dst1, int dst2, int count) { for (int i = 0; i < count; ++i) @@ -885,8 +893,7 @@ class LongArray } else { - add(T0, tOff, T0, tOff - bMax, bMax); - add(T0, tOff, T0, bMax, bMax); + add(T0, bMax, T0, tOff - bMax, T0, tOff, bMax); } } @@ -895,6 +902,7 @@ class LongArray */ long[] T1 = new long[T0.length]; shiftLeft(T0, 0, T1, 0, T0.length, 4); +// shiftLeft(T0, bMax, T1, bMax, tOff, 4); long[] a = A.m_ints; long[] c = new long[cLen]; |