Edit File: crypt.cpython-37.pyc
B ����q}�c ������������������@���s����d�Z�ddlZddlZddlmZ�ddlmZ �ej ej�d�Ze��Z G�dd��de dd��Zd#dd �d d�Zd$dd �Zg�Zdd �dd�Zedddd��edddd��x,dD�]$Zedde�ddee��dd �r�P�q�W�edddd��ed dd!d"��[[dS�)%zEWrapper to the POSIX crypt library call and associated functionality.�����N)�SystemRandom)� namedtuplez./c���������������@���s���e�Zd�ZdZdd��ZdS�)�_MethodziClass representing a salt method per the Modular Crypt Format or the legacy 2-character crypt method.c�������������C���s���d��|�j�S�)Nz<crypt.METHOD_{}>)�format�name)�self��r����*/opt/alt/python37/lib64/python3.7/crypt.py�__repr__���s����z_Method.__repr__N)�__name__� __module__�__qualname__�__doc__r ���r���r���r���r ���r��� ���s���r���z name ident salt_chars total_size)�roundsc������������C���sB��|�dkrt�d�}�|dk r4t|t�s4t|jj��d���|�js@d}nd|�j��d�}|�jr�|�jd�dkr�|dkrpd}n@t�|d��}|d|>�kr�td ��d |��kr�dks�n�td��||d �d�7�}n^|�jdk�r|dk �r d|��kr�dks�n�td��|d|��d�7�}n|dk �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. Nr���z+ 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 argumentc�������������s���s���|�]}t��t�V��qd�S�)N)�_srZchoice� _saltchars)�.0�charr���r���r ���� <genexpr>8���s����zmksalt.<locals>.<genexpr>)�methods� isinstance�int� TypeError� __class__r���Zident� bit_length� ValueError�join�rangeZ salt_chars)�methodr����sZ log_roundsr���r���r ����mksalt���s2���� r)���c�������������C���s&���|dkst�|t�rt|�}t�|�|�S�)aR��Return 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���r���r)����_crypt�crypt)Zword�saltr���r���r ���r+���<���s���� r+���c������������G���sV���t�|�f|���}|t��d|��<�t||d�}td|�}|rRt|�|jkrRt�|��dS�dS�)NZMETHOD_)r���r���TF)r����globalsr)���r+����lenZ total_sizer����append)r���r����argsr'���r,����resultr���r���r ����_add_methodN���s���� r2���ZSHA512r��������j���ZSHA256r����?���)�b�y�ar���ZBLOWFISHr��������;���ZMD5�1�����"���ZCRYPT����� ���)N)N)r���r*����stringZ_stringZrandomr���Z _SystemRandom�collectionsr���Z_namedtupleZ ascii_lettersZdigitsr���r���r���r)���r+���r���r2���Z_vr.���r���r���r���r ����<module>���s&��� &