5#ifndef BITCOIN_CRYPTO_CHACHA_POLY_AEAD_H
6#define BITCOIN_CRYPTO_CHACHA_POLY_AEAD_H
static constexpr int CHACHA20_POLY1305_AEAD_KEY_LEN
static constexpr int AAD_PACKAGES_PER_ROUND
static constexpr int CHACHA20_POLY1305_AEAD_AAD_LEN
static constexpr int CHACHA20_ROUND_OUTPUT
A class for ChaCha20 256-bit stream cipher developed by Daniel J.
bool Crypt(uint64_t seqnr_payload, uint64_t seqnr_aad, int aad_pos, uint8_t *dest, size_t dest_len, const uint8_t *src, size_t src_len, bool is_encrypt)
Encrypts/decrypts a packet.
uint64_t m_cached_aad_seqnr
bool GetLength(uint32_t *len24_out, uint64_t seqnr_aad, int aad_pos, const uint8_t *ciphertext)
decrypts the 3 bytes AAD data and decodes it into a uint32_t field
uint8_t m_aad_keystream_buffer[CHACHA20_ROUND_OUTPUT]
ChaCha20Poly1305AEAD(const ChaCha20Poly1305AEAD &)=delete
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...