'Generate a random hash based on the salt and the auth key.'

def _get_crypt_hash(self, salt, auth_key):

    if (not isinstance(salt, (six.binary_type, six.text_type))):
        salt = str(salt)
    if isinstance(salt, six.text_type):
        salt = salt.encode('utf-8')
    if (not isinstance(auth_key, (six.binary_type, six.text_type))):
        auth_key = str(auth_key)
    if isinstance(auth_key, six.text_type):
        auth_key = auth_key.encode('utf-8')
    return hmac.new(salt, auth_key, hashlib.sha1).hexdigest()
