a �DOg��@s2ddlZz ddlZWn.eyBejdkr6ed��ned��Yn0ddlZddlZddl m Z ddl m ZejejdZe �ZGdd �d ed d ��Zd%dd �d d �Zd&dd�ZgZdd �dd�Zedddd�edddd�dD](Zeddeddee�dd �r��qq�eddd d!�ed"dd#d$�[[dS)'�N�win32z,The crypt module is not supported on Windowsz;The required _crypt module was not built as part of CPython)� SystemRandom)� namedtuplez./c@seZdZdd�ZdS)�_MethodcCs d�|j�S)Nz)�format�name)�self�r �/usr/lib64/python3.9/crypt.py�__repr__sz_Method.__repr__N)�__name__� __module__� __qualname__r r r r r rsrz name ident salt_chars total_size��roundscCsB|durtd}|dur4t|t�s4t|jj�d���|js@d}nd|j�d�}|jr�|jddkr�|durpd}n@t�|d�}|d|>kr�td��d |kr�d ks�ntd ��||d �d�7}n^|jd v�r|du�r d|kr�dks�ntd��|d|�d�7}n|du�r t|�d���|d� dd�t |j �D��7}|S)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**31Z02d)�5�6i�i�ɚ;z+rounds out of the range 1000 to 999_999_999zrounds=z$ doesn't support the rounds argumentcss|]}t�t�VqdS�N)�_sr�choice� _saltchars)�.0�charr r r � B�zmksalt..) �methods� isinstance�int� TypeError� __class__r �ident� bit_length� ValueError�join�rangeZ salt_chars)�methodr�sZ log_roundsr r r �mksalt s2    r.cCs&|dust|t�rt|�}t�||�Sr)r#rr.�_crypt�crypt)Zword�saltr r r r0Fs r0c Gs�t|g|�R�}|t�d|<t||d�}d}ztd|�}Wn@ty|}z(|jtjkrfWYd}~dS�WYd}~n d}~00|r�t|�|jkr�t � |�dSdS)NZMETHOD_rrFT) r�globalsr.r0�OSError�errno�EINVAL�lenZ total_sizer"�append)rr�argsr,r1�result�er r r � _add_methodXs   r;�SHA512r��j�SHA256r�?)�b�y�arZBLOWFISHr��;�MD5�1��"ZCRYPT�� )N)N)�sys�_sysr/�ModuleNotFoundError�platform� ImportErrorr4�string�_string�randomrZ _SystemRandom� collectionsrZ _namedtuple� ascii_letters�digitsrrrr.r0r"r;Z_vr6r r r r �s2       &