Functions
decode core
fn (hex-str: Str): Bytes
Decode hexadecimal string to bytes.
Example
decode("48656c6c6f")
// [0x48, 0x65, 0x6c, 0x6c, 0x6f] (bytes for "Hello")
// Convert to string
Str(::hot::base64/decode(::hot::base64/encode(decode("48656c6c6f"))))
encode core
fn (data: Str | Bytes): Str
Encode bytes or string to hexadecimal string.
Example
encode("Hello")
// "48656c6c6f"
encode([0x48, 0x65, 0x6c, 0x6c, 0x6f])
// "48656c6c6f"
is-valid
fn (s: Str): Bool
Check if a string is valid hexadecimal (even length, valid hex characters).
Example
is-valid("48656c6c6f") // true
is-valid("48656c6c6") // false (odd length)
is-valid("ghijkl") // false (invalid chars)