Skip to main content

CHACHA20_IETF_MAX_LEN

Constant CHACHA20_IETF_MAX_LEN 

Source
pub const CHACHA20_IETF_MAX_LEN: u64 = _ /* 274_877_906_816u64 */;
Expand description

Maximum number of bytes that may be encrypted under a single (key, nonce) pair with the IETF (RFC 8439) layout.

RFC 8439 Section 2.8 caps the IETF variant at 2^32 - 1 blocks of 64 bytes because the block counter is 32 bits wide. This constant keeps one block of margin (2^32 - 2 blocks) so the counter can never wrap and reuse keystream.

Exceeding this limit makes the ChaCha20-Poly1305 / XChaCha20-Poly1305 / ChaCha8-Poly1305 AEADs panic on encryption and return AeadError::InvalidCiphertext on decryption, and makes StreamCipher::xor_keystream panic.