functions for domain-handling - encoding, hash - as one function; subdomain recursion loop