
    dI              
          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      /croot/python-split_1694437901252/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_plac/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MD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    ~*VS"9"96+4 5 5 5 6 6 	6<  | JQ3..>JJq11J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ME&:K4L4LMMM	M	MMA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"(GIIi$&(((DFr4   7u|U[%,???55555	
  #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MMMM 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  Xg . . . . "W^3d:
moo5 5 5 5 5kk)%GHH 5 5 5#$ # # # # #L$ $ $ $  $(     " Hc2s # # # Hc2r " " "   B{:sRxR##b''\$GGG  E32    GT1b ! ! !s    '4