more docs
This commit is contained in:
parent
ce65aa7715
commit
50dcc217ea
BIN
ed25519.dll
BIN
ed25519.dll
Binary file not shown.
42
readme.md
42
readme.md
@ -4,18 +4,42 @@ Ed25519
|
|||||||
This is a portable implementation of [Ed25519](http://ed25519.cr.yp.to/). All
|
This is a portable implementation of [Ed25519](http://ed25519.cr.yp.to/). All
|
||||||
code is in the public domain.
|
code is in the public domain.
|
||||||
|
|
||||||
No code uses libc, except for the random seed generation which uses standard
|
All code is pure ANSI C without any dependencies, except for the random seed
|
||||||
OS cryptography APIs. If you wish to be entirely portable define
|
generation which uses standard OS cryptography APIs. If you wish to be
|
||||||
`ED25519_NO_SEED`. This does disable the `ed25519_create_seed` function
|
entirely portable define `ED25519_NO_SEED`. This does disable the
|
||||||
however.
|
`ed25519_create_seed` function however (you can use your own seeding function
|
||||||
|
if you wish.)
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Simply add all .c and .h files in the src/ folder to your project and include
|
Simply add all .c and .h files in the `src/` folder to your project and
|
||||||
ed25519.h. If you prefer to use a shared library, only copy `ed25519.h` and define
|
include `ed25519.h` in any file you want to use the API. If you prefer to use
|
||||||
`ED25519_DLL` before importing. A windows DLL is pre-built.
|
a shared library, only copy `ed25519.h` and define `ED25519_DLL` before
|
||||||
|
importing. A windows DLL is pre-built.
|
||||||
|
|
||||||
The API is simple:
|
There are no defined types for seeds, signing keys, verifying keys or
|
||||||
|
signatures. Instead simple `unsigned char` buffers are used with the following
|
||||||
|
sizes:
|
||||||
|
|
||||||
int ED25519_DECLSPEC ed25519_create_seed(unsigned char *seed);
|
unsigned char seed[32]
|
||||||
|
unsigned char signature[64]
|
||||||
|
unsigned char verify_key[32]
|
||||||
|
unsigned char signing_key[64]
|
||||||
|
|
||||||
|
API
|
||||||
|
---
|
||||||
|
|
||||||
|
int ed25519_create_seed(unsigned char *seed);
|
||||||
|
|
||||||
|
Creates a 32 byte random seed in `seed` for key generation. `seed` must be a
|
||||||
|
writable 32 byte buffer.
|
||||||
|
|
||||||
|
int ed25519_create_keypair(unsigned char *verify_key, unsigned char *sign_key, const unsigned char *seed);
|
||||||
|
|
||||||
|
Creates a new key pair from the given seed. `verify_key` must be a writable 32
|
||||||
|
byte buffer, `sign_key` must be a writable 64 byte buffer and `seed` must be a
|
||||||
|
32 byte buffer.
|
||||||
|
|
||||||
|
int ed25519_sign(unsigned char *signature, const unsigned char *message, size_t message_len, const unsigned char *sign_key);
|
||||||
|
int ed25519_verify(const unsigned char *signature, const unsigned char *message, size_t message_len, const unsigned char *verify_key);
|
@ -24,7 +24,7 @@ extern "C" {
|
|||||||
int ED25519_DECLSPEC ed25519_create_seed(unsigned char *seed);
|
int ED25519_DECLSPEC ed25519_create_seed(unsigned char *seed);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int ED25519_DECLSPEC ed25519_create_keypair(unsigned char *verify_key, unsigned char *sign_key, unsigned char *seed);
|
int ED25519_DECLSPEC ed25519_create_keypair(unsigned char *verify_key, unsigned char *sign_key, const unsigned char *seed);
|
||||||
int ED25519_DECLSPEC ed25519_sign(unsigned char *signature, const unsigned char *message, size_t message_len, const unsigned char *sign_key);
|
int ED25519_DECLSPEC ed25519_sign(unsigned char *signature, const unsigned char *message, size_t message_len, const unsigned char *sign_key);
|
||||||
int ED25519_DECLSPEC ed25519_verify(const unsigned char *signature, const unsigned char *message, size_t message_len, const unsigned char *verify_key);
|
int ED25519_DECLSPEC ed25519_verify(const unsigned char *signature, const unsigned char *message, size_t message_len, const unsigned char *verify_key);
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include "ge.h"
|
#include "ge.h"
|
||||||
|
|
||||||
|
|
||||||
int ed25519_create_keypair(unsigned char *verify_key, unsigned char *sign_key, unsigned char *seed) {
|
int ed25519_create_keypair(unsigned char *verify_key, unsigned char *sign_key, const unsigned char *seed) {
|
||||||
unsigned char h[64];
|
unsigned char h[64];
|
||||||
ge_p3 A;
|
ge_p3 A;
|
||||||
int i;
|
int i;
|
||||||
|
Loading…
Reference in New Issue
Block a user