Your IP : 3.139.70.69


Current Path : /opt/alt/python39/lib64/python3.9/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/__pycache__/crypt.cpython-39.opt-1.pyc

a

R�f��@s6dZddlZzddlZWn.eyFejdkr:ed��ned��Yn0ddlZddlZ	ddl
mZddl
mZe	je	jdZe�ZGd	d
�d
ed
d��Zd&dd�d
d�Zd'dd�ZgZdd�dd�Zedddd�edddd�dD](Zeddeddee�dd�r��qq�edd d!d"�ed#dd$d%�[[dS)(zEWrapper to the POSIX crypt library call and associated functionality.�NZwin32z,The crypt module is not supported on Windowsz;The required _crypt module was not built as part of CPython)�SystemRandom)�
namedtuplez./c@seZdZdZdd�ZdS)�_MethodziClass representing a salt method per the Modular Crypt Format or the
    legacy 2-character crypt method.cCsd�|j�S)Nz<crypt.METHOD_{}>)�format�name)�self�r�*/opt/alt/python39/lib64/python3.9/crypt.py�__repr__sz_Method.__repr__N)�__name__�
__module__�__qualname__�__doc__r
rrrr	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�dks�ntd��||d
�d�7}n^|jdv�r|du�r d|kr�dks�ntd��|d|�d�7}n|du�r t|�d���|d�	dd�t
|j�D��7}|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**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)�_srZchoice�
_saltchars)�.0�charrrr	�	<genexpr>B�zmksalt.<locals>.<genexpr>)�methods�
isinstance�int�	TypeError�	__class__rZident�
bit_length�
ValueError�join�rangeZ
salt_chars)�methodr�sZ
log_roundsrrr	�mksalt s2

r+cCs&|dust|t�rt|�}t�||�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()``.

    N)r!rr+�_crypt�crypt)Zword�saltrrr	r-Fs
r-c
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+r-�OSError�errnoZEINVAL�lenZ
total_sizer �append)rr�argsr)r.�result�errr	�_add_methodXs
r7ZSHA512r��jZSHA256r�?)�b�y�arZBLOWFISHr��;ZMD5�1��"ZCRYPT��
)N)N)r�sys�_sysr,�ModuleNotFoundError�platform�ImportErrorr1�stringZ_stringZrandomrZ
_SystemRandom�collectionsrZ_namedtupleZ
ascii_lettersZdigitsrrrr+r-r r7Z_vr2rrrr	�<module>s4

	&


?>