DoxigAlpha

encodedLen

Returns the length of the encoded base64 string for a given length.

Function parameters

Parameters

#
bin_len:usize

(best-effort) constant time hexadecimal encoding and decoding.

Types

#
hex
(best-effort) constant time hexadecimal encoding and decoding.
base64
(best-effort) constant time base64 encoding and decoding.

Error sets in this namespace

Error Sets

#

Source

Implementation

#
pub fn encodedLen(bin_len: usize, variant: Variant) usize {
    if (variant.padding) {
        return (bin_len + 2) / 3 * 4;
    } else {
        const leftover = bin_len % 3;
        return bin_len / 3 * 4 + (leftover * 4 + 2) / 3;
    }
}