def auth_data(self, data):
    'Hashing for MySQL 4.1 authentication.\n\n        Args:\n            data (str): The authentication data.\n\n        Returns:\n            str: The authentication response.\n        '
    if self._password:
        password = (self._password.encode('utf-8') if isinstance(self._password, str) else self._password)
        hash1 = hashlib.sha1(password).digest()
        hash2 = hashlib.sha1(hash1).digest()
        xored = xor_string(hash1, hashlib.sha1((data + hash2)).digest(), 20)
        return '{0}\x00{1}\x00*{2}\x00'.format('', self._username, hexlify(xored))
    return '{0}\x00{1}\x00'.format('', self._username)
Hashing for MySQL 4.1 authentication.

Args:
    data (str): The authentication data.

Returns:
    str: The authentication response.
def auth_data(self, data):
    'Hashing for MySQL 4.1 authentication.\n\n        Args:\n            data (str): The authentication data.\n\n        Returns:\n            str: The authentication response.\n        '
    if self._password:
        password = (self._password.encode('utf-8') if isinstance(self._password, str) else self._password)
        hash1 = hashlib.sha1(password).digest()
        hash2 = hashlib.sha1(hash1).digest()
        xored = xor_string(hash1, hashlib.sha1((data + hash2)).digest(), 20)
        return '{0}\x00{1}\x00*{2}\x00'.format(, self._username, hexlify(xored))
    return '{0}\x00{1}\x00'.format(, self._username)