grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026B &<K¿;)Nã@sòdZddlZddlZddlmZddlmZ ej ej dZ eƒZ Gdd„de ddƒƒZd#dd œd d „Zd$d d „ZgZdd œdd„Zeddddƒeddddƒx,dD]$Zeddeddeeƒdd �r¦Pq¦Weddddƒed dd!d"ƒ[[dS)%zEWrapper to the POSIX crypt library call and associated functionality.éN)Ú SystemRandom)Ú namedtuplez./c@seZdZdZdd„ZdS)Ú_MethodziClass representing a salt method per the Modular Crypt Format or the legacy 2-character crypt method.cCs d |j¡S)Nz)ÚformatÚname)Úself©rú*/opt/alt/python37/lib64/python3.7/crypt.pyÚ__repr__sz_Method.__repr__N)Ú__name__Ú __module__Ú __qualname__Ú__doc__r rrrr r srz 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 ú 8szmksalt..) Ú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)rrr)Ú_cryptÚcrypt)ZwordÚsaltrrr r+<s 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_methodNs   r2ZSHA512rééjZSHA256ré?)ÚbÚyÚarZBLOWFISHréé;ZMD5Ú1éé"ZCRYPTéé )N)N)rr*ÚstringZ_stringZrandomrZ _SystemRandomÚ collectionsrZ _namedtupleZ ascii_lettersZdigitsrrrr)r+rr2Z_vr.rrrr Ús&   &