Skip to content

Conversation

@str4d
Copy link
Owner

@str4d str4d commented May 11, 2014

This pull request refactors the existing BigInteger implementation so all BigInteger-specific code is in a single subpackage. The Ed25519-specific radix-2^51 implementation from ref10 is then implemented, resulting in a considerable speed boost (signing is about 3.5x faster, verifying is about 8.5x faster).

str4d added 20 commits May 10, 2014 01:02
This probably isn't constant time because of the Z1==Z2 check. If it should be,
we can drop that first part (and there is still a speed increase from removing
the two FieldElement.invert() calls).
Sign/verify tests fail, but all other tests pass. The problem is probably in
ScalarOps somewhere.
…with long

The test fails (likely because all longs are signed in Java)
The only BigInteger operations used are and(), or() and shift[Left|Right]()
(but it is possible that these are not constant time?)
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.
Most FieldElement implementations (in particular, the ref10 implementation)
don't have a generic pow() method, and instead will have I hard-coded.
Before black magic:
0.5548 each sign, 2.4118 each verify, 2.9666 s+v
After black magic:
0.1572 each sign, 0.2798 each verify, 0.437 s+v
str4d added a commit that referenced this pull request May 11, 2014
Radix-2^51 support from ref10
@str4d str4d merged commit 7f54968 into master May 11, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants