You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: this code is from 2008. Since that time, many more, great implementations of curve25519 have been written, including several amd64 assembly versions by djb. You are probably better served now by NaCl or libsodium.
curve25519 is an elliptic curve, developed by Dan Bernstein, for fast Diffie-Hellman key agreement. DJB's original implementation was written in a language of his own devising called qhasm. The original qhasm source isn't available, only the x86 32-bit assembly output.
Since many x86 systems are now 64-bit, and portability is important, this project provides alternative implementations for other platforms.
Implementation
Platform
Author
32-bit speed
64-bit speed
Constant Time
curve25519
x86 32-bit
djb
265µs
N/A
yes
curve25519-donna-c64
64-bit C
agl
N/A
215µs
yes
curve25591-donna
Portable C
agl
2179µs
610µs
(All tests run on a 2.33GHz Intel Core2)
Usage
The usage is exactly the same as djb's code (as described at https://cr.yp.to/ecdh.html) except that the function is called curve25519\_donna.
To generate a private key, generate 32 random bytes and: