HEX
Server: Microsoft-IIS/10.0
System: Windows NT ITPWINWEBSVR22 10.0 build 20348 (Windows Server 2022) AMD64
User: www.conferencesearch.co.uk (0)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: D:/Python311/Lib/site-packages/mysqlx/__pycache__/authentication.cpython-311.pyc
�

�nc?���dZddlZddlZddlmZd�ZGd�d��ZGd�d	e��ZGd
�de��ZGd�d
e��Z	dS)z.Implementation of MySQL Authentication Plugin.�N�)�hexlifyc�`�d�t||��D��}tj|�d�g|�R�S)z�Encrypt/Decrypt function used for password encryption in
    authentication, using a simple XOR.

    Args:
        hash1 (str): The first hash.
        hash2 (str): The second hash.

    Returns:
        str: A string with the xor applied.
    c��g|]
\}}||z��S�r)�.0�h1�h2s   �7D:\Python311\Lib\site-packages\mysqlx/authentication.py�
<listcomp>zxor_string.<locals>.<listcomp>0s ��7�7�7��"�b�R�"�W�7�7�7��B)�zip�struct�pack)�hash1�hash2�	hash_size�xoreds    r�
xor_stringr%s?��
8�7�S���%6�%6�7�7�7�E��;�)����/��/�/�/�/r
c�&�eZdZdZdd�Zd�Zd�ZdS)�BaseAuthPluginz7Base class for implementing the authentication plugins.Nc�"�||_||_dS)N��	_username�	_password)�self�username�passwords   r�__init__zBaseAuthPlugin.__init__7s��!���!����r
c��t�)�UReturns the plugin name.

        Returns:
            str: The plugin name.
        ��NotImplementedError�rs r�namezBaseAuthPlugin.name;�
��"�!r
c��t�)�eReturns the authentication name.

        Returns:
            str: The authentication name.
        r#r%s r�	auth_namezBaseAuthPlugin.auth_nameCr'r
)NN)�__name__�
__module__�__qualname__�__doc__r r&r*rr
rrr4sL������A�A�"�"�"�"�"�"�"�"�"�"�"�"r
rc�$�eZdZdZd�Zd�Zd�ZdS)�MySQL41AuthPluginzCClass implementing the MySQL Native Password authentication plugin.c��dS)r"zMySQL 4.1 Authentication Pluginrr%s rr&zMySQL41AuthPlugin.nameOs
��1�0r
c��dS)r)�MYSQL41rr%s rr*zMySQL41AuthPlugin.auth_nameWs	���yr
c���|jr�t|jt��r|j�d��n|j}t	j|�����}t	j|�����}t|t	j||z�����d��}d|j�dt|���d�Sd|j�d�S)z�Hashing for MySQL 4.1 authentication.

        Args:
            data (str): The authentication data.

        Returns:
            str: The authentication response.
        �utf-8��z*)
r�
isinstance�str�encode�hashlib�sha1�digestrrr�r�datarrrrs      r�	auth_datazMySQL41AuthPlugin.auth_data_s����>�		>��d�n�c�2�2�$���%�%�g�.�.�.��^�
�
�L��*�*�1�1�3�3�E��L��'�'�.�.�0�0�E��u�g�l�4�%�<�&@�&@�&G�&G�&I�&I�2�N�N�E�=���=�=�7�5�>�>�=�=�=�=�&�D�N�&�&�&�&r
N�r+r,r-r.r&r*r@rr
rr0r0LsG������M�M�1�1�1����'�'�'�'�'r
r0c�$�eZdZdZd�Zd�Zd�ZdS)�PlainAuthPluginz9Class implementing the MySQL Plain authentication plugin.c��dS)r"zPlain Authentication Pluginrr%s rr&zPlainAuthPlugin.namexs
��-�,r
c��dS)r)�PLAINrr%s rr*zPlainAuthPlugin.auth_name�s	���wr
c�&�d|j�d|j��S)zeReturns the authentication data.

        Returns:
            str: The authentication data.
        r7rr%s rr@zPlainAuthPlugin.auth_data�s��7�D�N�6�6�d�n�6�6�6r
NrArr
rrCrCusG������C�C�-�-�-����7�7�7�7�7r
rCc�$�eZdZdZd�Zd�Zd�ZdS)�Sha256MemoryAuthPluginz;Class implementing the SHA256_MEMORY authentication plugin.c��dS)r"z#SHA256_MEMORY Authentication Pluginrr%s rr&zSha256MemoryAuthPlugin.name�s
��5�4r
c��dS)r)�
SHA256_MEMORYrr%s rr*z Sha256MemoryAuthPlugin.auth_name�s	���r
c��t|jt��r|j�d��n|j}t	j|�����}t	jt	j|�����|z�����}t||d��}d|j�dt|����S)a Hashing for SHA256_MEMORY authentication.

        The scramble is of the form:
            SHA256(SHA256(SHA256(PASSWORD)),NONCE) XOR SHA256(PASSWORD)

        Args:
            data (str): The authentication data.

        Returns:
            str: The authentication response.
        r5� r7)
r8rr9r:r;�sha256r=rrrr>s      rr@z Sha256MemoryAuthPlugin.auth_data�s����$�.�#�.�.�
 �D�N�!�!�'�*�*�*���	�
��x�(�(�/�/�1�1����w�~�e�4�4�;�;�=�=��D�E�E�L�L�N�N���5�%��,�,��6�D�N�6�6�g�e�n�n�6�6�6r
NrArr
rrIrI�sG������E�E�5�5�5����7�7�7�7�7r
rI)
r.r;r�helpersrrrr0rCrIrr
r�<module>rQs���:5�4�����
�
�
�
�������0�0�0�"�"�"�"�"�"�"�"�0&'�&'�&'�&'�&'��&'�&'�&'�R7�7�7�7�7�n�7�7�7�8'7�'7�'7�'7�'7�^�'7�'7�'7�'7�'7r