yabase/base16

Values

pub fn decode(
  input: String,
) -> Result(BitArray, encoding.CodecError)

Decode a hexadecimal string to a BitArray.

pub fn encode(data: BitArray) -> String

Encode a BitArray to an uppercase hexadecimal string per RFC 4648 §8 (the canonical Base 16 encoding).

Use encode_lowercase/1 when interoperating with tools that emit lowercase hex (e.g. sha256sum, IPFS multibase prefix f, many JSON Web Token implementations); the decoder accepts either case, so round-trips work in both directions.

pub fn encode_lowercase(data: BitArray) -> String

Encode a BitArray to a lowercase hexadecimal string. Use this when interoperating with tools that expect the lowercase variant (sha256sum shell output, IPFS multibase prefix f, etc.). The canonical RFC 4648 §8 form is uppercase — see encode/1.

Search Document