package core:encoding/base32

⌘K
Ctrl+K
or
/

    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.

    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, 
    }

    Decode_Options ¶

    Decode_Options :: bit_set[Decode_Option; u8]

    Related Procedures With Parameters

    Encode_Option ¶

    Encode_Option :: enum int {
    	No_Padding, 
    }

    Encode_Options ¶

    Encode_Options :: bit_set[Encode_Option; u8]

    Related Procedures With Parameters

    Constants

    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) {…}

    decode_into ¶

    decode_into :: proc(
    	w:       io.Stream, 
    	data:    string, 
    	DEC_TBL: [256]i8 = DEC_TABLE, 
    	options: bit_set[Decode_Option; u8] = Decode_Options{}, 
    ) -> Error {…}

    decode_into_buf ¶

    decode_into_buf :: proc(
    	dst:     []u8, 
    	data:    string, 
    	DEC_TBL: [256]i8 = DEC_TABLE, 
    	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 {…}

    encode_into ¶

    encode_into :: proc(
    	w:       io.Stream, 
    	data:    []u8, 
    	ENC_TBL: [32]u8 = ENC_TABLE, 
    	options: bit_set[Encode_Option; u8] = Encode_Options{}, 
    ) -> io.Error {…}

    encode_into_buf ¶

    encode_into_buf :: proc(
    	dst, data: []u8, 
    	ENC_TBL:   [32]u8 = ENC_TABLE, 
    	options:   bit_set[Encode_Option; u8] = Encode_Options{}, 
    ) -> (encoded: []u8, err: Error) {…}

    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