7 void ed25519_sign(unsigned char *signature
, const unsigned char *message
, size_t message_len
, const unsigned char *public_key
, const unsigned char *private_key
) {
9 unsigned char hram
[64];
15 sha512_update(&hash
, private_key
+ 32, 32);
16 sha512_update(&hash
, message
, message_len
);
17 sha512_final(&hash
, r
);
20 ge_scalarmult_base(&R
, r
);
21 ge_p3_tobytes(signature
, &R
);
24 sha512_update(&hash
, signature
, 32);
25 sha512_update(&hash
, public_key
, 32);
26 sha512_update(&hash
, message
, message_len
);
27 sha512_final(&hash
, hram
);
30 sc_muladd(signature
+ 32, hram
, private_key
, r
);