Function decodedLenForSlice [src]

Returns the decoded length of a base64 string, ignoring any characters in the ignore list. This operation does not run in constant time, but it aims to avoid leaking information about the underlying base64 string.

Prototype

pub fn decodedLenForSlice(decoder: DecoderWithIgnore, encoded: []const u8, variant: Variant) !usize

Parameters

decoder: DecoderWithIgnoreencoded: []const u8variant: Variant

Source

pub fn decodedLenForSlice(decoder: DecoderWithIgnore, encoded: []const u8, variant: Variant) !usize { var b64_len = encoded.len; for (encoded) |c| { if (decoder.ignored_chars.isSet(c)) b64_len -= 1; } return base64.decodedLen(b64_len, variant); }