Expand description
Hex encoding and decoding for byte slices and files.
Converts between raw bytes and their hexadecimal string representation.
Decoding accepts mixed-case input and optional 0x prefix.
The library has zero dependencies.
§Features
encode— encode bytes to a lowercase hex string.encode_upper— encode bytes to an uppercase hex string.decode— decode a hex string to bytes; accepts mixed case and0xprefix.HexError— error type for malformed input.
§Quick Start
use rune_hex::{encode, decode};
let hex = encode(b"hello");
assert_eq!(hex, "68656c6c6f");
let bytes = decode(&hex).unwrap();
assert_eq!(bytes, b"hello");Enums§
Functions§
- decode
- Decodes a hex string to bytes.
- encode
- Encodes bytes as a lowercase hex string.
- encode_
upper - Encodes bytes as an uppercase hex string.