#ifndef ROSETTA_CRYPTO_H
#define ROSETTA_CRYPTO_H

#include <stddef.h>
#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
 * HSalsa20 core — used by nacl.box.before() to derive shared key.
 * out: 32 bytes, inp: 16 bytes (nonce, zeros for box.before), key: 32 bytes
 */
void rosetta_hsalsa20(uint8_t out[32],
                      const uint8_t inp[16],
                      const uint8_t key[32]);

/**
 * XChaCha20 XOR (encrypt = decrypt, symmetric stream cipher).
 * out and in may overlap. nonce: 24 bytes, key: 32 bytes.
 */
void rosetta_xchacha20_xor(uint8_t *out,
                           const uint8_t *in,
                           size_t len,
                           const uint8_t nonce[24],
                           const uint8_t key[32]);

#ifdef __cplusplus
}
#endif

#endif /* ROSETTA_CRYPTO_H */
