Function armorlib::util::hex_to_vec
[−]
[src]
pub fn hex_to_vec(hex: &str) -> Result<Vec<u8>, ParseIntError>
A utility function that converts a string of space-separated hexadecimal bytes into a Vec<u8>
for use by preprocessors, scan modules, and other programs.
Examples
use armorlib::util; assert_eq!( util::hex_to_vec("00 00 01 00 BA 3C 2B A9").unwrap(), [ 0x00_u8, 0x00_u8, 0x01_u8, 0x00_u8, 0xBA_u8, 0x3C_u8, 0x2B_u8, 0xA9_u8 ] ); match util::hex_to_vec("invalid HEX string") { Ok(_) => assert!(false), Err(_) => assert!(true), }