Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/quite/humla-spongycastle.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2014-01-04 13:13:30 +0400
committerPeter Dettman <peter.dettman@bouncycastle.org>2014-01-04 13:13:30 +0400
commit550a6b0bf8e351b4ae32f2a23caa640b93d0dafd (patch)
tree0bee1f3df1de47614ccff798db6853b08ccc1a51
parent084b0d8269ca7f9eae2ad6c78e0e62a3b36a57ad (diff)
Small modification to the intro for square()
-rw-r--r--core/src/main/java/org/bouncycastle/math/ec/custom/sec/Nat256.java15
1 files changed, 11 insertions, 4 deletions
diff --git a/core/src/main/java/org/bouncycastle/math/ec/custom/sec/Nat256.java b/core/src/main/java/org/bouncycastle/math/ec/custom/sec/Nat256.java
index e8aae609..b5b5b0a6 100644
--- a/core/src/main/java/org/bouncycastle/math/ec/custom/sec/Nat256.java
+++ b/core/src/main/java/org/bouncycastle/math/ec/custom/sec/Nat256.java
@@ -457,22 +457,29 @@ public abstract class Nat256
public static void square(int[] x, int[] zz)
{
+ long x_0 = x[0] & M;
+ long zz_1;
+
{
- int c = 0, i = 8, j = 16;
+ int c = 0, i = 7, j = 16;
do
{
- long xVal = (x[--i] & M);
+ long xVal = (x[i--] & M);
long p = xVal * xVal;
zz[--j] = (c << 31) | (int)(p >>> 33);
zz[--j] = (int)(p >>> 1);
c = (int)p;
}
while (i > 0);
+
+ {
+ long p = x_0 * x_0;
+ zz_1 = ((c << 31) & M) | (p >>> 33);
+ zz[0] = (int)(p >>> 1);
+ }
}
- long x_0 = x[0] & M;
long x_1 = x[1] & M;
- long zz_1 = zz[1] & M;
long zz_2 = zz[2] & M;
{