Tor Utilities
*************

Miscellaneous utility functions for working with tor.

New in version 1.2.0.

**Module Overview:**

   is_valid_fingerprint - checks if a string is a valid tor relay fingerprint
   is_valid_nickname - checks if a string is a valid tor relay nickname
   is_valid_circuit_id - checks if a string is a valid tor circuit id
   is_valid_stream_id - checks if a string is a valid tor stream id
   is_valid_connection_id - checks if a string is a valid tor connection id
   is_valid_hidden_service_address - checks if a string is a valid hidden service address
   is_hex_digits - checks if a string is only made up of hex digits

stem.util.tor_tools.is_valid_fingerprint(entry, check_prefix=False)

   Checks if a string is a properly formatted relay fingerprint. This
   checks for a ‘$’ prefix if check_prefix is true, otherwise this
   only validates the hex digits.

   Parameters:
      * **entry** (*str*) – string to be checked

      * **check_prefix** (*bool*) – checks for a ‘$’ prefix

   Returns:
      **True** if the string could be a relay fingerprint, **False**
      otherwise

stem.util.tor_tools.is_valid_nickname(entry)

   Checks if a string is a valid format for being a nickname.

   Parameters:
      **entry** (*str*) – string to be checked

   Returns:
      **True** if the string could be a nickname, **False** otherwise

stem.util.tor_tools.is_valid_circuit_id(entry)

   Checks if a string is a valid format for being a circuit
   identifier.

   Returns:
      **True** if the string could be a circuit id, **False**
      otherwise

stem.util.tor_tools.is_valid_stream_id(entry)

   Checks if a string is a valid format for being a stream identifier.
   Currently, this is just an alias to "is_valid_circuit_id()".

   Returns:
      **True** if the string could be a stream id, **False** otherwise

stem.util.tor_tools.is_valid_connection_id(entry)

   Checks if a string is a valid format for being a connection
   identifier. Currently, this is just an alias to
   "is_valid_circuit_id()".

   Returns:
      **True** if the string could be a connection id, **False**
      otherwise

stem.util.tor_tools.is_valid_hidden_service_address(entry, version=None)

   Checks if a string is a valid format for being a hidden service
   address (not including the ‘.onion’ suffix).

   Changed in version 1.8.0: Added the **version** argument, and
   responds with **True** if a version 3 hidden service address rather
   than just version 2 addresses.

   Parameters:
      **version** (*int**,**list*) – versions to check for, if
      unspecified either v2 or v3 hidden service address will provide
      **True**

   Returns:
      **True** if the string could be a hidden service address,
      **False** otherwise

stem.util.tor_tools.is_hex_digits(entry, count)

   Checks if a string is the given number of hex digits. Digits
   represented by letters are case insensitive.

   Parameters:
      * **entry** (*str*) – string to be checked

      * **count** (*int*) – number of hex digits to be checked for

   Returns:
      **True** if the given number of hex digits, **False** otherwise
