![]() |
nrfxlib API 3.3.99
|
ChaCha20 and XChaCha20 algorithms. More...
Files | |
| file | ocrypto_chacha20.h |
| ChaCha20 and XChaCha20 algorithms. | |
Macros | |
| #define | ocrypto_chacha20_KEY_BYTES (32) |
| #define | ocrypto_chacha20_NONCE_BYTES_MAX (12) |
Functions | |
| void | ocrypto_chacha20_encode (uint8_t *c, const uint8_t *m, size_t m_len, const uint8_t *n, size_t n_len, const uint8_t key[(32)], uint32_t count) |
Incremental ChaCha20 Encoder | |
This group of functions can be used to incrementally compute the ChaCha20 encryption or decryption for a given message and key, by segmenting a message into smaller chunks. Use pattern: Encoding/Decoding: ocrypto_chacha20_init(ctx, n, n_len, key, count);
ocrypto_chacha20_update(ctx, c, m, m_len);
...
ocrypto_chacha20_update(ctx, c, m, m_len);
void ocrypto_chacha20_init(ocrypto_chacha20_ctx *ctx, const uint8_t *n, size_t n_len, const uint8_t key[(32)], uint32_t count) void ocrypto_chacha20_update(ocrypto_chacha20_ctx *ctx, uint8_t *c, const uint8_t *m, size_t m_len) | |
| void | ocrypto_chacha20_init (ocrypto_chacha20_ctx *ctx, const uint8_t *n, size_t n_len, const uint8_t key[(32)], uint32_t count) |
| void | ocrypto_chacha20_update (ocrypto_chacha20_ctx *ctx, uint8_t *c, const uint8_t *m, size_t m_len) |
ChaCha20 and XChaCha20 algorithms.
ChaCha20 is a stream cipher developed by Daniel J. Bernstein based on the 20-round cipher Salsa20/20.
A 256-bit key is expanded into 2^64 randomly accessible streams, each containing 2^64 randomly accessible 64-byte (512-bit) blocks.
The changes from Salsa20/20 to ChaCha20 are designed to improve diffusion per round, conjecturally increasing resistance to cryptanalysis, while preserving - and often improving - time per round.
XChaCha20 uses a 192-bit nonce instead of ChaCha20's 96-bit nonce.