package core:encoding/hex
Overview
Encoding and decoding of hex-encoded binary, e.g. 0x23 -> #.
Index
Types (0)
This section is empty.
Constants (0)
This section is empty.
Variables (0)
This section is empty.
Procedure Groups (0)
This section is empty.
Types
This section is empty.
Constants
This section is empty.
Variables
This section is empty.
Procedures
decode ¶
decode :: proc( src: []u8, allocator := context.allocator, loc := #caller_location, ) -> (dst: []u8, ok: bool) {…}
Decodes a hex sequence into a byte slice
Allocates Using Provided Allocator
Inputs:
- src The
[]byteto be hex-decoded - allocator (default: context.allocator)
- loc The caller location for debugging purposes (default: #caller_location)
Returns:
- dst The hex sequence decoded into bytes
- ok A bool,
trueif decoding succeeded,falseotherwise
decode_into_buffer ¶
Decodes a hex sequence into a byte slice
Inputs:
- src The
[]byteto be hex-decoded - buf A buffer large enough to hold the decoded sequence
Returns:
- dst The hex sequence decoded into bytes
- ok A bool,
trueif decoding succeeded,falseotherwise
decode_sequence ¶
Decodes the first byte in a hex sequence to a byte
Inputs:
- str A hex-encoded
string, e.g."0x23"
Returns:
- res The decoded byte, e.g.
'#' - ok A bool,
trueif decoding succeeded,falseotherwise
encode ¶
encode :: proc( src: []u8, allocator := context.allocator, loc := #caller_location, ) -> (res: []u8, err: runtime.Allocator_Error) #optional_ok {…}
Encodes a byte slice into a lowercase hex sequence
Allocates Using Provided Allocator
Inputs:
- src The
[]byteto be hex-encoded - allocator (default: context.allocator)
- loc The caller location for debugging purposes (default: #caller_location)
Returns:
- res The hex-encoded result
- err An optional allocator error if one occured,
.Noneotherwise
encode_upper ¶
encode_upper :: proc( src: []u8, allocator := context.allocator, loc := #caller_location, ) -> (res: []u8, err: runtime.Allocator_Error) #optional_ok {…}
Encodes a byte slice into an uppercase hex sequence
Allocates Using Provided Allocator
Inputs:
- src The
[]byteto be hex-encoded - allocator (default: context.allocator)
- loc The caller location for debugging purposes (default: #caller_location)
Returns:
- res The hex-encoded result
- err An optional allocator error if one occured,
.Noneotherwise
Procedure Groups
This section is empty.
Source Files
Generation Information
Generated with odin version dev-2026-10 (vendor "odin") Windows_amd64 @ 2026-10-10 00:25:51.511820200 +0000 UTC