Skip to main content

parse_hex

Function parse_hex 

Source
pub fn parse_hex(input: &str) -> Result<Vec<u8>>
Expand description

Parse a hexadecimal string into raw bytes.

The input is trimmed before decoding. This helper is used by load_batch and the CLI to convert user-provided hex strings into byte arrays suitable for hashing comparisons.

§Examples

let bytes = hash_hunter::parse_hex("0a0b0c")?;
assert_eq!(bytes, vec![0x0a, 0x0b, 0x0c]);

§Errors

Returns an error if the input is not valid hex.