§
    (¶ÕiI  ã            
       ó  — d Z ddlZ	 ddlZn*# e$ r" ej        dk    r ed¦  «        ‚ ed¦  «        ‚w xY wddlZddlZ	ddl
Z
ddlmZ ddlmZ  e
j        ed¬	¦  «         e	j        e	j        z   d
z   Z e¦   «         Z G d„ d edd¦  «        ¦  «        Zd%ddœd„Zd%d„Zg Zddœd„Z edddd¦  «          edddd¦  «         dD ]#Z eddez   dd ee¦  «        z   d¬¦  «        r nŒ$ eddd d!¦  «          ed"dd#d$¦  «         [[dS )&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                   ó   — e Zd ZdZd„ ZdS )Ú_MethodziClass representing a salt method per the Modular Crypt Format or the
    legacy 2-character crypt method.c                 ó6   — d                      | j        ¦  «        S )Nz<crypt.METHOD_{}>)ÚformatÚname)Úselfs    ú/usr/lib/python3.11/crypt.pyÚ__repr__z_Method.__repr__    s   € Ø"×)Ò)¨$¬)Ñ4Ô4Ð4ó    N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   © r   r   r
   r
      s-   € € € € € ð(ð (ð5ð 5ð 5ð 5ð 5r   r
   z name ident salt_chars total_size©Úroundsc                óž  — | €t           d         } |�1t          |t          ¦  «        st          |j        j        › d�¦  «        ‚| j        sd}nd| j        › d�}| j        rs| j        d         dk    rb|€d}nSt                               |dz
  ¦  «        }|d|z  k    rt          d	¦  «        ‚d
|cxk    rdk    sn t          d¦  «        ‚||d›d�z  }nG| j        dv r*|�'d|cxk    rdk    sn t          d¦  «        ‚|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.

    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**31Ú02d)Ú5Ú6iè  iÿÉš;z+rounds out of the range 1000 to 999_999_999zrounds=z$ doesn't support the rounds argumentc              3   óT   K  — | ]#}t                                t          ¦  «        V — Œ$d S ©N)Ú_srÚchoiceÚ
_saltchars)Ú.0Úchars     r   ú	<genexpr>zmksalt.<locals>.<genexpr>F   s.   è è € Ð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Ø€Hr   c                 óx   — |�t          |t          ¦  «        rt          |¦  «        }t          j        | |¦  «        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()``.

    )r-   r
   r:   Ú_cryptÚcrypt)ÚwordÚsalts     r   r=   r=   J   s4   € ð €|•z $­Ñ0Ô0€|Ý�d‰|Œ|ˆÝŒ<˜˜dÑ#Ô#Ð#r   c                ó„  — t          | g|¢R Ž }|t          ¦   «         d| z   <   t          ||¬¦  «        }d }	 t          d|¦  «        }nC# t          $ r6}|j        t
          j        t
          j        t
          j        hv rY d }~dS ‚ d }~ww xY w|r4t          |¦  «        |j
        k    rt                               |¦  «         dS dS )NÚMETHOD_r   r   FT)r
   Úglobalsr:   r=   ÚOSErrorÚerrnoÚEINVALÚEPERMÚENOSYSÚlenÚ
total_sizer,   Úappend)r   r   Úargsr7   r?   Ú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é   r   r%   )r   ÚsysÚ_sysr<   ÚModuleNotFoundErrorÚplatformÚImportErrorrD   ÚstringÚ_stringÚwarningsÚrandomr   Ú_SystemRandomÚcollectionsr   Ú_namedtupleÚ_deprecatedr   Úascii_lettersÚdigitsr(   r&   r
   r:   r=   r,   rN   Ú_vrH   r   r   r   ú<module>rp      s1  ðØ 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