std::hex

std/src/hex.mo

Hex codecs: lowercase output, case-insensitive input.

std's SHA-256 keeps its byte→hex helper private, so the general form lives here: pure and portable, the single home for hex.

typeHexError#
pub type HexError {
    /// An odd number of characters: the last nibble has no partner.
    odd_length,
    /// A character outside `0-9 a-f A-F`.
    invalid_char
}

Why a hex string was rejected. to_string is the only render point.

defHexError.to_string#
pub def HexError.to_string (e : HexError) : String
defHex.encode#
pub def Hex.encode (bs : List U8) : String
defHex.decode#
pub def Hex.decode (s : String) : Result HexError (List U8)