� !A?hI� ��dZddlZ ddlZn*#e$r"ejdkr ed���ed���wxYwddlZddlZ ddl Z ddl m Z ddlmZe jed� ��e je jzd zZe ��ZGd �d ed d ����Zd%dd�d�Zd%d�ZgZdd�d�Zedddd��edddd��dD]#Zeddezddee��zd���rn�$eddd d!��ed"dd#d$��[[dS)&zEWrapper to the POSIX crypt library call and associated functionality.�N�win32z,The crypt module is not supported on Windowsz;The required _crypt module was not built as part of CPython)� SystemRandom)� namedtuple)�� )�removez./c��eZdZdZd�ZdS)�_MethodziClass representing a salt method per the Modular Crypt Format or the legacy 2-character crypt method.c�6�d�|j��S)Nz)�format�name)�selfs �2/opt/alt/python-internal/lib64/python3.11/crypt.py�__repr__z_Method.__repr__ s��"�)�)�$�)�4�4�4�N)�__name__� __module__� __qualname__�__doc__r�rrr r s-������(�(�5�5�5�5�5rr z name ident salt_chars total_size��roundsc��|� td}|�1t|t��st|jj�d����|jsd}n d|j�d�}|jrs|jddkrb|�d}nSt�|dz ��}|d|zkrtd ���d |cxkrd ksntd ���||d �d�z }nG|jdvr*|�'d|cxkrdksntd���|d|�d�z }n|�t|�d����|d� d�t|j ��D����z }|S)zsGenerate a salt for the specified method. If not specified, the strongest available method will be used. Nrz+ object cannot be interpreted as an integer��$�2� �zrounds must be a power of 2��z%rounds out of the range 2**4 to 2**31�02d)�5�6i�i�ɚ;z+rounds out of the range 1000 to 999_999_999zrounds=z$ doesn't support the rounds argumentc3�TK�|]#}t�t��V��$dS�N)�_sr�choice� _saltchars)�.0�chars r� zmksalt..Fs.����M�M�D����J�'�'�M�M�M�M�M�Mr) �methods� isinstance�int� TypeError� __class__r�ident� bit_length� ValueError�join�range� salt_chars)�methodr�s� log_roundss r�mksaltr:$s��� �~����� ��*�V�S�"9�"9���6�+�4�5�5�5�6�6� 6� �<� � ��� �� � � � �� �|�J�� �Q��3�.�.� �>��J�J�����q��1�1�J���j��(�(� �!>�?�?�?�� �(�(�(�(�b�(�(�(�(� �!H�I�I�I� � � !� !� !� !�!��� ��� #� #� � ��6�0�0�0�0�[�0�0�0�0� �!N�O�O�O� �$�6�$�$�$� $�A�� � ��F�H�H�H�I�I�I�����M�M�E�&�:K�4L�4L�M�M�M� M� M�M�A� �Hrc�x�|�t|t��rt|��}tj||��S)aRReturn a string representing the one-way hash of a password, with a salt prepended. If ``salt`` is not specified or is ``None``, the strongest available method will be selected and a salt generated. Otherwise, ``salt`` may be one of the ``crypt.METHOD_*`` values, or a string as returned by ``crypt.mksalt()``. )r-r r:�_crypt�crypt)�word�salts rr=r=Js4�� �|�z�$��0�0�|��d�|�|�� �<��d� #� #�#rc��t|g|�R�}|t��d|z<t||���}d} td|��}nC#t$r6}|jt jt jt jhvrYd}~dS�d}~wwxYw|r4t|��|j krt� |��dSdS)N�METHOD_rrFT) r �globalsr:r=�OSError�errno�EINVAL�EPERM�ENOSYS�len� total_sizer,�append)r r�argsr7r?�result�es r� _add_methodrN\s��� �T� !�D� !� !� !�F�"(�G�I�I�i�$��� �&�� (� (� (�D� �F���r�4������ ���� �7�u�|�U�[�%�,�?� ?� ?��5�5�5�5�5� ����� ���� ��#�f�+�+��!2�2�2����v�����t� �5s�A� B�*B�B�B�SHA512r#��j�SHA256r"�?)�b�y�ar�BLOWFISHr��;�MD5�1��"�CRYPT�rr%)r�sys�_sysr<�ModuleNotFoundError�platform� ImportErrorrD�string�_string�warnings�randomr� _SystemRandom� collectionsr� _namedtuple� _deprecatedr� ascii_letters�digitsr(r&r r:r=r,rN�_vrHrrr�rps1��K�K�����Y��M�M�M�M���Y�Y�Y� �}�����k�H�I�I�I��k�W�X�X�X� Y����  � � � ���������0�0�0�0�0�0�1�1�1�1�1�1����X�g�.�.�.�.�� "�W�^� 3�d� :� ��m�o�o��5�5�5�5�5�k�k�)�%G�H�H�5�5�5�# �$�# �# �# �# �# �L $� $� $� $� ��$(������" � �H�c�2�s�#�#�#� � �H�c�2�r�"�"�"� ���B��{�:�s�R�x��R�#�#�b�'�'�\�$�G�G�G�� ��� � �E�3��2���� � �G�T�1�b�!�!�!�� � � s� �'4