[curves] pure-python Ed25519 library for review
warner at lothar.com
Tue Apr 7 16:03:12 PDT 2015
On 4/7/15 3:32 PM, Ron Garret wrote:
> Is there a reason you don’t just use DJB’s reference implementation?
Yeah, it was painfully slow. This code started from that base, and was
then modified (by you or dholth, I think) to use extended coordinates.
Then I went through and picked off the low-hanging fruit (use python's
native 3-argument pow(), use hexlify/int(s,16) instead of manual
bits-to-int/int-to-bits) to speed it up further.
I just added a copy of that original to my repo (in misc/) for
comparison. The original cr.yp.to version gets:
% PYTHONPATH=misc python misc/speed_orig_ed25519.py
and the subsequent changes brought that down ~500x to:
% PYTHONPATH=. python pure25519/speed_ed25519.py
Two and a half seconds to verify a signature (on a fairly fast machine)
was hard to stomach. 11ms is way easier.
More information about the Curves