1 2 3 4 5 6 7
pub fn decode_hex(s: &str) -> Vec<u8> { assert!(s.len().is_multiple_of(2)); (0..s.len()) .step_by(2) .map(|i| u8::from_str_radix(&s[i..i + 2], 16).unwrap()) .collect() }