package core:encoding/base32
Overview
Base32 encoding and decoding, as specified in RFC 4648.
A secondary param can be used to supply a custom alphabet to encode and a matching decoding
table to decode. If none is supplied it uses the standard Base32 alphabet. ENC_HEX_TABLE and
DEC_HEX_TABLE hold the "Extended Hex" alphabet of RFC 4648 section 7.
By default encode emits padding. With {.No_Padding} it omits it, and encoded_len reports
the shorter length.
By default decode is lenient, accepting padded and unpadded input and not checking the
trailing padding bits. {.Strict} requires canonical input (RFC 4648 section 3.5): exact
padding and zero trailing bits. {.Strict, .No_Padding} accepts only canonical unpadded input.
Index
Constants (1)
Variables (4)
Procedures (8)
Procedure Groups (0)
This section is empty.
Types
Decode_Error ¶
Decode_Error :: enum int { None, Invalid_Character, Invalid_Padding, Non_Canonical, Malformed_Quantum, }
Decode_Option ¶
Decode_Option :: enum int { Strict, No_Padding, }
Encode_Option ¶
Encode_Option :: enum int { No_Padding, }
Error ¶
Error :: union { runtime.Allocator_Error, io.Error, Decode_Error, }
Related Procedures With Returns
Constants
PADDING ¶
PADDING :: '='
Variables
DEC_HEX_TABLE ¶
@(rodata) DEC_HEX_TABLE: [256]i8 = …
DEC_TABLE ¶
@(rodata) DEC_TABLE: [256]i8 = …
ENC_HEX_TABLE ¶
@(rodata) ENC_HEX_TABLE: [32]u8 = …
ENC_TABLE ¶
@(rodata) ENC_TABLE: [32]u8 = …
Procedures
decode ¶
decode :: proc( data: string, DEC_TBL: [256]i8 = DEC_TABLE, allocator := context.allocator, options: bit_set[Decode_Option; u8] = Decode_Options{}, ) -> (decoded: []u8, err: Error) {…}
decoded_len ¶
decoded_len :: proc( data: string, DEC_TBL: [256]i8 = DEC_TABLE, options: bit_set[Decode_Option; u8] = Decode_Options{}, ) -> (n: int, err: Decode_Error) {…}
encode ¶
encode :: proc( data: []u8, ENC_TBL: [32]u8 = ENC_TABLE, allocator := context.allocator, options: bit_set[Encode_Option; u8] = Encode_Options{}, ) -> (encoded: string, err: runtime.Allocator_Error) #optional_ok {…}
encoded_len ¶
encoded_len :: proc(data: []u8, options: bit_set[Encode_Option; u8] = Encode_Options{}) -> int {…}
Procedure Groups
This section is empty.
Source Files
Generation Information
Generated with odin version dev-2026-11 (vendor "odin") Windows_amd64 @ 2026-11-18 21:05:19.828955300 +0000 UTC