Skip to main content

Module codec

Module codec 

Source
Expand description

Hex and Base64 codecs.

These exist so the CLI, MCP server, and ontology exports can move key material and test vectors around without pulling in a dependency. The decoders are constant-time with respect to the values they decode, which matters because agents routinely paste secrets through these paths.

Functionsยง

b64
Encode input as a padded standard Base64 String.
base64_decode
Decode padded standard Base64, returning the number of bytes written.
base64_encode
Encode input as padded standard Base64 into out.
base64_encoded_len
Length of the standard-alphabet, padded Base64 encoding of n bytes.
hex
Encode input as a lowercase hex String.
hex_decode
Decode a hex string into out, accepting either case.
hex_encode
Encode input as lowercase hex into out.
unb64
Decode a padded standard Base64 string into a freshly allocated Vec.
unhex
Decode a hex string into a freshly allocated Vec.