DoxigAlpha

decode

Decodes a base64 string into a binary buffer. The output buffer must be at least decodedLenUpperBound(encoded.len) bytes long.

Function parameters

Parameters

#
bin:[]u8
encoded:[]const u8

(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 decode(bin: []u8, encoded: []const u8, comptime variant: Variant) error{ InvalidCharacter, InvalidPadding }![]const u8 {
    return decodeAny(bin, encoded, variant, null) catch |err| {
        switch (err) {
            error.InvalidCharacter => return error.InvalidCharacter,
            error.InvalidPadding => return error.InvalidPadding,
            else => unreachable,
        }
    };
}