little docs improvements
This commit is contained in:
parent
ae5f9678cb
commit
75216d602b
20
readme.md
20
readme.md
@ -68,10 +68,9 @@ void ed25519_sign(unsigned char *signature,
|
||||
const unsigned char *public_key, const unsigned char *private_key);
|
||||
```
|
||||
|
||||
Creates a signature of the given message with the keypair `(public_key,
|
||||
private_key)`. `signature` must be a writable 64 byte buffer. `message` must
|
||||
have at least `message_len` bytes to be read. The given keypair must be a
|
||||
keypair generated by `ed25519_create_keypair`.
|
||||
Creates a signature of the given message with the given key pair. `signature`
|
||||
must be a writable 64 byte buffer. `message` must have at least `message_len`
|
||||
bytes to be read.
|
||||
|
||||
```c
|
||||
int ed25519_verify(const unsigned char *signature,
|
||||
@ -81,15 +80,18 @@ int ed25519_verify(const unsigned char *signature,
|
||||
|
||||
Verifies the signature on the given message using `public_key`. `signature`
|
||||
must be a readable 64 byte buffer. `message` must have at least `message_len`
|
||||
bytes to be read. `public_key` must be a 32 byte public key generated by
|
||||
`ed25519_create_keypair`. Returns 1 if the signature matches, 0 otherwise.
|
||||
bytes to be read. Returns 1 if the signature matches, 0 otherwise.
|
||||
|
||||
```c
|
||||
void ed25519_add_scalar(unsigned char *public_key, unsigned char *private_key,
|
||||
const unsigned char *scalar);
|
||||
```
|
||||
|
||||
Adds `scalar` to the given keypair where scalar is a 32 byte buffer (possibly generated with `ed25519_create_seed`), generating a new keypair. You can calculate the public key sum without knowing the private key and vice versa by passing in NULL. This is useful for enforcing randomness on a keypair while only knowing the public key, among other things.
|
||||
Adds `scalar` to the given key pair where scalar is a 32 byte buffer (possibly
|
||||
generated with `ed25519_create_seed`), generating a new key pair. You can
|
||||
calculate the public key sum without knowing the private key and vice versa by
|
||||
passing in NULL for the key you don't know. This is useful for enforcing
|
||||
randomness on a key pair while only knowing the public key, among other things.
|
||||
|
||||
Example
|
||||
-------
|
||||
@ -97,7 +99,7 @@ Example
|
||||
unsigned char seed[32], public_key[32], private_key[64], signature[64];
|
||||
const unsigned char message[] = "TEST MESSAGE";
|
||||
|
||||
/* create a random seed, and a keypair out of that seed */
|
||||
/* create a random seed, and a key pair out of that seed */
|
||||
if (ed25519_create_seed(seed)) {
|
||||
printf("error while generating seed\n");
|
||||
exit(1);
|
||||
@ -105,7 +107,7 @@ if (ed25519_create_seed(seed)) {
|
||||
|
||||
ed25519_create_keypair(public_key, private_key, seed);
|
||||
|
||||
/* create signature on the message with the keypair */
|
||||
/* create signature on the message with the key pair */
|
||||
ed25519_sign(signature, message, strlen(message), public_key, private_key);
|
||||
|
||||
/* verify the signature */
|
||||
|
Loading…
Reference in New Issue
Block a user