Skip to main content

Module hex

Module hex 

Source
Expand description

Hexadecimal encoding and decoding (RFC 4648 §8, Base16).

Zero-dependency replacement for the hex crate.

§Supply Chain Sovereignty

This module has zero external dependencies. It replaces the hex crate for the nexcore ecosystem, eliminating supply chain risk for hex encoding.

§Examples

use nexcore_codec::hex;

let encoded = hex::encode(b"Hello");
assert_eq!(encoded, "48656c6c6f");

let decoded = hex::decode("48656c6c6f").unwrap();
assert_eq!(decoded, b"Hello");

Enums§

DecodeError
Error returned when decoding an invalid hex string.

Functions§

decode
Decode a hex string to bytes.
encode
Encode bytes to a lowercase hex string.
encode_upper
Encode bytes to an uppercase hex string.