use crate::spec::types::ParityFailure;
use std::fs;
use std::io::{self, Write};
use std::path::PathBuf;
use std::sync::atomic::{AtomicU64, Ordering};
use std::time::{SystemTime, UNIX_EPOCH};
#[cfg(loom)]
use loom::sync::Mutex as LoomMutex;
use super::hex::*;
pub(super) fn decode_hex(text: &str) -> Result<Vec<u8>, String> {
if text.len() % 2 != 0 {
return Err("hex input has odd length. Fix: use two hex chars per byte.".to_string());
}
let mut out = Vec::with_capacity(text.len() / 2);
for chunk in text.as_bytes().chunks(2) {
let high = from_hex(chunk[0])?;
let low = from_hex(chunk[1])?;
out.push((high << 4) | low);
}
Ok(out)
}