U e5dã@s0dZddlZz ddlZWn0ek rHejdkr)ÚformatÚname)Úself©rú/usr/lib64/python3.8/crypt.pyÚ__repr__sz_Method.__repr__N)Ú__name__Ú __module__Ú __qualname__Ú__doc__r rrrr rsrz name ident salt_chars total_size©ÚroundscCsB|dkrtd}|dk r4t|tƒs4t|jj›d�ƒ‚|js@d}nd|j›d�}|jrÂ|jddkrÂ|dkrpd}n@t |d¡}|d|>kr’td ƒ‚d |kr¦d ks°ntd ƒ‚||d ›d�7}n^|jdk�r|dk �r d|krìdksöntdƒ‚|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. 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 Ú Aszmksalt..) ÚmethodsÚ isinstanceÚintÚ TypeErrorÚ __class__r ZidentÚ bit_lengthÚ ValueErrorÚjoinÚrangeZ salt_chars)ÚmethodrÚsZ log_roundsrrr Úmksalts2    r*cCs&|dkst|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,Es r,cGsVt|f|žŽ}|tƒd|<t||d�}td|ƒ}|rRt|ƒ|jkrRt |¡dSdS)NZMETHOD_rrTF)rÚglobalsr*r,ÚlenZ total_sizerÚappend)rrÚargsr(r-Úresultrrr Ú _add_methodWs   r3ZSHA512rééjZSHA256ré?)ÚbÚyÚarZBLOWFISHréé;ZMD5Ú1éé"ZCRYPTéé )N)N)rÚsysÚ_sysr+ÚModuleNotFoundErrorÚplatformÚ ImportErrorÚstringZ_stringZrandomrZ _SystemRandomÚ collectionsrZ _namedtupleZ ascii_lettersZdigitsrrrr*r,rr3Z_vr/rrrr Ús2      &