Skip to content

Commit 14b4c1f

Browse files
committed
Use Ed25519ScalarOps instead of BigIntegerScalarOps
Before: 0.534 each sign, 2.3272 each verify, 2.8612 s+v After: 0.5888 each sign, 2.3566 each verify, 2.9454 s+v Sign uses reduce() twice, verify uses it once. Therefore the ref10 version is about 28us slower than the BigInteger version. Basically negligible, so the important factor to determine is whether the BigInteger operations used are constant time. If we can't get the ref10 version to be constant time, we may as well use the BigInteger version.
1 parent 4625342 commit 14b4c1f

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/net/i2p/crypto/eddsa/spec/EdDSANamedCurveTable.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
package net.i2p.crypto.eddsa.spec;
22

3-
import java.math.BigInteger;
43
import java.util.Hashtable;
54

65
import net.i2p.crypto.eddsa.Utils;
76
import net.i2p.crypto.eddsa.math.Curve;
87
import net.i2p.crypto.eddsa.math.Field;
98
import net.i2p.crypto.eddsa.math.bigint.BigIntegerLittleEndianEncoding;
10-
import net.i2p.crypto.eddsa.math.bigint.BigIntegerScalarOps;
9+
import net.i2p.crypto.eddsa.math.ed25519.Ed25519ScalarOps;
1110

1211
/**
1312
* The named EdDSA curves.
@@ -29,8 +28,7 @@ public class EdDSANamedCurveTable {
2928
CURVE_ED25519_SHA512,
3029
ed25519curve,
3130
"SHA-512", // H
32-
new BigIntegerScalarOps(ed25519field,
33-
new BigInteger("7237005577332262213973186563042994240857116359379907606001950938285454250989")), // l
31+
new Ed25519ScalarOps(), // l
3432
ed25519curve.createPoint( // B
3533
Utils.hexToBytes("5866666666666666666666666666666666666666666666666666666666666666"),
3634
true)); // Precompute tables for B

0 commit comments

Comments
 (0)