
Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­
<!DOCTYPE html>
<html>
U
    ¡ê,a  ã                   @   s0  d Z ddlZzddlZW n0 ek
rH   ejdkr<edƒ‚nedƒ‚Y nX ddlZddl	m
Z ddlmZ ejej d Zeƒ ZG d	d
„ d
ed
dƒƒZd&ddœdd„Zd'dd„Zg Zddœdd„Zeddddƒ eddddƒ dD ](Zedde ddeeƒ dd�râ �qqâedd d!d"ƒ ed#dd$d%ƒ [[dS )(zEWrapper to the POSIX crypt library call and associated functionality.é    NZwin32z,The crypt module is not supported on Windowsz;The required _crypt module was not built as part of CPython)ÚSystemRandom)Ú
namedtuplez./c                   @   s   e Zd ZdZdd„ ZdS )Ú_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/python38/lib64/python3.8/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  | dkrt d } |dk	r4t|tƒs4t|jj› d�ƒ‚| js@d}nd| j› d�}| jrÂ| jd dkrÂ|dkrpd}n@t |d ¡}|d|> kr’td	ƒ‚d
|  kr¦dks°n tdƒ‚||d›d�7 }n^| jdk�r|dk	�r d|  krìdksön tdƒ‚|d|› d�7 }n|dk	�r t| › d�ƒ‚|d 	dd„ 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é   é   zrounds must be a power of 2é   é   z%rounds out of the range 2**4 to 2**31Z02d)Ú5Ú6iè  iÿÉš;z+rounds out of the range 1000 to 999_999_999zrounds=z$ doesn't support the rounds argumentc                 s   s   | ]}t  t¡V  qd S )N)Ú_srZchoiceÚ
_saltchars)Ú.0Úcharr   r   r	   Ú	<genexpr>A   s     zmksalt.<locals>.<genexpr>)ÚmethodsÚ
isinstanceÚintÚ	TypeErrorÚ	__class__r   ZidentÚ
bit_lengthÚ
ValueErrorÚjoinÚrangeZ
salt_chars)Úmethodr   ÚsZ
log_roundsr   r   r	   Úmksalt   s2    

r*   c                 C   s&   |dkst |tƒrt|ƒ}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)ZwordÚsaltr   r   r	   r,   E   s    
r,   c                G   sV   t | f|žŽ }|tƒ d|  < t||d�}td|ƒ}|rRt|ƒ|jkrRt |¡ dS dS )NZMETHOD_r   r   TF)r   Úglobalsr*   r,   ÚlenZ
total_sizer   Úappend)r   r   Úargsr(   r-   Úresultr   r   r	   Ú_add_methodW   s    

r3   ZSHA512r   é   éj   ZSHA256r   é?   )ÚbÚyÚar   ZBLOWFISHr   é   é;   ZMD5Ú1é   é"   ZCRYPTé   é   )N)N)r   ÚsysÚ_sysr+   ÚModuleNotFoundErrorÚplatformÚImportErrorÚstringZ_stringZrandomr   Z_SystemRandomÚcollectionsr   Z_namedtupleZascii_lettersZdigitsr   r   r   r*   r,   r   r3   Z_vr/   r   r   r   r	   Ú<module>   s2   

	&

