a
XC?hë ã @ s6 d Z ddlZzddlZW n. eyF ejdkr:edƒ‚nedƒ‚Y n0 ddlZddlZ ddl
mZ ddl
mZ e je j d Zeƒ ZG d d
„ d
ed
dƒƒZd&ddœd
d„Zd'dd„Zg Zddœdd„Zeddddƒ eddddƒ dD ](Zedde ddeeƒ dd�rè �qqèedd d!d"ƒ ed#dd$d%ƒ [[dS )(zEWrapper to the POSIX crypt library call and associated functionality.é NZwin32z,The crypt module is not supported on Windowsz;The required _crypt module was not built as part of CPython)ÚSystemRandom)Ú
namedtuplez./c @ s e Zd ZdZdd„ ZdS )Ú_MethodziClass representing a salt method per the Modular Crypt Format or the
legacy 2-character crypt method.c C s d | j¡S )Nz)ÚformatÚname)Úself© r ú*/opt/alt/python39/lib64/python3.9/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 | du rt d } |dur4t|tƒs4t|jj› d�ƒ‚| js@d}nd| j› d�}| jrÂ| jd dkrÂ|du rpd}n@t |d ¡}|d|> kr’td ƒ‚d
| kr¦dks°n tdƒ‚||d
›d�7 }n^| jdv �r|du�r d| krìdksön tdƒ‚|d|› d�7 }n|du�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.
Nr z+ 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 argumentc s s | ]}t t¡V qd S )N)Ú_srZchoiceÚ
_saltchars)Ú.0Úcharr r r Ú B ó zmksalt..)ÚmethodsÚ
isinstanceÚintÚ TypeErrorÚ __class__r ZidentÚ
bit_lengthÚ
ValueErrorÚjoinÚrangeZ
salt_chars)Úmethodr ÚsZ
log_roundsr r r Úmksalt s2
r+ c C s&