1 See http://code.google.com/p/curve25519-donna/ for details.
5 If you run `make`, two .a archives will be built, similar to djb's curve25519
6 code. Alternatively, read on:
8 The C implementation is contained within curve25519-donna.c. It has no external
9 dependancies and is BSD licenced. You can copy/include/link it directly in with
10 your program. Recommended C flags: -O2
12 The x86-64 bit implementation is contained within curve25519-donna-x86-64.c and
13 curve25519-donna-x86-64.s. Build like this:
15 % cpp curve25519-donna-x86-64.s > curve25519-donna-x86-64.s.pp
16 % as -o curve25519-donna-x86-64.s.o curve25519-donna-x86-64.s.pp
17 % gcc -O2 -c curve25519-donna-x86-64.c
19 Then the two .o files can be linked in
23 The usage is exactly the same as djb's code (as described at
24 http://cr.yp.to/ecdh.html) expect that the function is called curve25519_donna.
28 To generate a private key just generate 32 random bytes.
30 To generate the public key, just do:
32 static const uint8_t basepoint[32] = {9};
33 curve25519_donna(mypublic, mysecret, basepoint);
35 To generate an agreed key do:
37 uint8_t shared_key[32];
38 curve25519_donna(shared_key, mysecret, theirpublic);
40 And hash the shared_key with a cryptographic hash function before using.