code wiki / (root) / hex.nx

hex.nx

buildroot/runtime/hex.nx

3331 B97 linesdepth 3pulls 3 transitivereach 4 importersview sourcekind tooltopic hex
docsdependenciesstructsconstsfunctions

about

hex.nx -- lowercase hex encoder + decoder. Complement to base64.nx for the common "print bytes as text" use cases where readability matters more than density: - SHA-256 / SHA-3 digest display - Git-style object IDs - TLS handshake transcripts for debugging - URL query parameters carrying short binary values Deterministic output (lowercase always). Decoder tolerates both upper and lower case. No "0x" prefix, no whitespace. Invariants: H1 Encoder output is exactly 2*n chars for n input bytes. H2 Decoder requires even-length input; rejects odd-length with a negative return. H3 Decoder rejects any non-hex char (not [0-9A-Fa-f]) with a negative return -- no silent skip. H4 Round-trip is exact: decode(encode(x)) == x for any byte sequence.

dependencies 1 imports · 4 importers

syscalls.nx hex.nx digest_auth.nx etag.nx f6_gate.nx uuid.nx

imports: syscalls.nx

imported by: digest_auth.nxetag.nxf6_gate.nxuuid.nx

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main hex_encode hex_decode hex_nibble

structs

none

consts

24const HEX_ERR_ODD_LENGTH: i64 = -1
25const HEX_ERR_INVALID_CHAR: i64 = -2

functions

29func hex_encode(in_bytes: *u8, n: i64, out: *u8) -> i64 {
47func hex_nibble(c: i64) -> i64 {
called by 1: hex_decode
56func hex_decode(in_chars: *u8, n: i64, out: *u8) -> i64 {
called by 1: main calls 1: hex_nibble
74func main() -> i64 {