B
&<K;)N @ s d dl Z d dlZd dlmZ d dlmZ ej ej
d Ze ZG dd deddZ
d"ddd d
Zd#ddZg Zddd
dZedddd edddd x,dD ]$Zedde ddee ddrP qW edddd eddd d! [[dS )$ N)SystemRandom)
namedtuplez./c @ s e Zd Zdd ZdS )_Methodc C s d | jS )Nz)formatname)self r */opt/alt/python37/lib64/python3.7/crypt.py__repr__ s z_Method.__repr__N)__name__
__module____qualname__r
r r r r r
s r z name ident salt_chars total_size)roundsc C sB | d krt d } |d k r4t|ts4t|jj d| js@d}nd| j d}| jr| jd dkr|d krpd}n@t|d }|d|> krtdd | krd
ksn td||dd7 }n^| jd
kr|d k r d| krdksn td|d| d7 }n|d k r t| d|d dd t
| jD 7 }|S )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)56i iɚ;z+rounds out of the range 1000 to 999_999_999zrounds=z$ doesn't support the rounds argumentc s s | ]}t tV qd S )N)_srchoice
_saltchars).0charr r r 8 s zmksalt..)methods
isinstanceint TypeError __class__r Zident
bit_length
ValueErrorjoinrangeZ
salt_chars)methodr sZ
log_roundsr r r mksalt s2
r) c C s&