#[must_use]
pub fn encode_hex_lower(bytes: &[u8]) -> String {
const HEX: &[u8; 16] = b"0123456789abcdef";
let mut out = String::with_capacity(bytes.len().saturating_mul(2));
for byte in bytes {
out.push(HEX[(byte >> 4) as usize] as char);
out.push(HEX[(byte & 0x0f) as usize] as char);
}
out
}
#[cfg(test)]
mod tests {
use crate::db::codec::hex::encode_hex_lower;
#[test]
fn encode_hex_lower_formats_bytes_without_prefix() {
assert_eq!(encode_hex_lower(&[0x00, 0x01, 0x0a, 0xff]), "00010aff");
}
#[test]
fn encode_hex_lower_handles_empty_input() {
assert_eq!(encode_hex_lower(&[]), "");
}
}