is_valid_fingerprint_with_prefix

Function is_valid_fingerprint_with_prefix 

Source
pub fn is_valid_fingerprint_with_prefix(s: &str) -> bool
Expand description

Validates a relay fingerprint with optional $ prefix.

This function accepts fingerprints with or without the $ prefix commonly used in Tor control protocol responses.

§Arguments

  • s - The string to validate

§Returns

true if the string is a valid fingerprint (with or without $ prefix).

§Example

use stem_rs::util::is_valid_fingerprint_with_prefix;

// Both formats are valid
assert!(is_valid_fingerprint_with_prefix("$9695DFC35FFEB861329B9F1AB04C46397020CE31"));
assert!(is_valid_fingerprint_with_prefix("9695DFC35FFEB861329B9F1AB04C46397020CE31"));

// Invalid
assert!(!is_valid_fingerprint_with_prefix("$ABCD")); // Too short