Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig standard library. Public Function

decodedLen

Public Function
std.crypto.codecs.base64_hex_ct.base64.decodedLen
pub fn decodedLen(b64_len: usize, variant: Variant) !usize

Returns the maximum possible decoded size for a given input length - The actual length may be less if the input includes padding. InvalidPadding is returned if the input length is not valid.

Params

File

crypto/codecs/base64_hex_ct.zig:177
177
178
179
180
181
182
183
184
185
186
187
    pub fn decodedLen(b64_len: usize, variant: Variant) !usize {
        var result = b64_len / 4 * 3;
        const leftover = b64_len % 4;
        if (variant.padding) {
            if (leftover % 4 != 0) return error.InvalidPadding;
        } else {
            if (leftover % 4 == 1) return error.InvalidPadding;
            result += leftover * 3 / 4;
        }
        return result;
    }