pub fn is_hex_digits(s: &str, length: usize) -> boolExpand description
Checks if a string contains exactly the specified number of hex digits.
This is a helper function for validating fixed-length hexadecimal strings like fingerprints and hashes.
§Arguments
s- The string to checklength- The expected number of hex digits
§Returns
true if the string has exactly length hexadecimal characters.
§Example
use stem_rs::util::is_hex_digits;
assert!(is_hex_digits("abcd", 4));
assert!(is_hex_digits("ABCD1234", 8));
assert!(is_hex_digits("0123456789abcdef", 16));
assert!(!is_hex_digits("abcd", 5)); // Wrong length
assert!(!is_hex_digits("ghij", 4)); // Invalid hex chars