Skip to main content

padding_trailer_len

Function padding_trailer_len 

Source
pub fn padding_trailer_len(plaintext_len: usize, policy: PaddingPolicy) -> usize
Available on crate feature std only.
Expand description

The number of trailer bytes to append to the AEAD plaintext to bring the resulting on-wire packet to a PADÉ bucket. 0 when no padding applies (policy None, or the packet is already too large to pad under MAX_SHAPED_WIRE). When non-zero it is ≥ PAD_LEN_FIELD (the 2-byte length field plus zero fill).

plaintext_len is the length of the inner AEAD plaintext before padding; the on-wire size is header(15) + plaintext_len + AEAD_OVERHEAD.