diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2013-09-28 17:24:52 +0400 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2013-09-28 17:24:52 +0400 |
commit | ba977669039e136cfd9ba56f99d87b1abbef0646 (patch) | |
tree | d0cd96898c840e20c58914e83c8b780a0bc661a6 /core | |
parent | 38e3accf4fa0bc6ca6d1b06bddcb030e087d809e (diff) |
For EC performance test, change the point every 10 rounds and change the
scalar every round
Diffstat (limited to 'core')
-rw-r--r-- | core/src/test/java/org/bouncycastle/math/ec/test/ECPointPerformanceTest.java | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/core/src/test/java/org/bouncycastle/math/ec/test/ECPointPerformanceTest.java b/core/src/test/java/org/bouncycastle/math/ec/test/ECPointPerformanceTest.java index 78255afc..f1513514 100644 --- a/core/src/test/java/org/bouncycastle/math/ec/test/ECPointPerformanceTest.java +++ b/core/src/test/java/org/bouncycastle/math/ec/test/ECPointPerformanceTest.java @@ -28,17 +28,27 @@ public class ECPointPerformanceTest extends TestCase final BigInteger n = spec.getN(); final SecureRandom random = SecureRandom.getInstance("SHA1PRNG", "SUN"); - final BigInteger k = new BigInteger(n.bitLength() - 1, random); + BigInteger k = new BigInteger(n.bitLength() - 1, random); - ECPoint qMultiply = null; - for (int i = 0; i < PRE_ROUNDS; i++) + ECPoint p = g; + for (int i = 1; i <= PRE_ROUNDS; i++) { - qMultiply = g.multiply(k); + p = g.multiply(k); + if (i % 10 == 0) + { + g = p; + } + k = k.flipBit(i % n.bitLength()); } long startTime = System.currentTimeMillis(); - for (int i = 0; i < NUM_ROUNDS; i++) + for (int i = 1; i <= NUM_ROUNDS; i++) { - qMultiply = g.multiply(k); + p = g.multiply(k); + if (i % 10 == 0) + { + g = p; + } + k = k.flipBit(i % n.bitLength()); } long endTime = System.currentTimeMillis(); |