StupidOS/lib/crypto/chacha20/chacha20.h

21 lines
421 B
C
Raw Normal View History

2024-03-26 06:48:32 +00:00
#ifndef CHACHA20_H
# define CHACHA20_H 1
# include <stdint.h>
2024-04-02 10:03:47 +00:00
# define CHACHA20_KEY_BYTES 32
2024-03-26 06:48:32 +00:00
# define CHACHA20_NONCE_BYTES 12
# define CHACHA20_BLOCK_BYTES 64
typedef struct
{
uint32_t state[4][4];
uint32_t ctr;
} ChaCha20Ctx;
void chacha20_init(ChaCha20Ctx *ctx, const uint8_t *key, uint32_t ctr,
const uint8_t *nonce);
void chacha20_block(ChaCha20Ctx *ctx, uint8_t *out);
#endif /* !CHACHA20_H */