a
    ø£Beò  ã                   @  sj   d dl mZ d dlZd dlZd dlZddlmZmZmZm	Z	m
Z
mZ dddœdd	„Zed
krfeejƒ dS )é    )ÚannotationsNé   )ÚDEFAULT_HASH_LENGTHÚDEFAULT_MEMORY_COSTÚDEFAULT_PARALLELISMÚDEFAULT_TIME_COSTÚPasswordHasherÚprofilesz	list[str]ÚNone)ÚargvÚreturnc           
      C  s   t jdd�}|jdtddd� |jdtdtd	� |jd
tdtd	� |jdtdtd	� |jdtdtd	� |jdtdd d	� | 	| dd … ¡}d}|j
r¬t tt|j
 ¡ ƒ¡}nt|j|j|j|jd�}| |¡}|jdf|jdf|jdf|jdfdœ}td|jf ƒ t| ¡ ƒD ]$\}}td||d |d f ƒ �qtdƒ tjd|›d|›d�d |j›d!|j›d"|j›d#|j›d$�	|jd%�}	td&|	|j d' d(›d)�ƒ d S )*NzBenchmark Argon2.)Údescriptionz-néd   z Number of iterations to measure.)ÚtypeÚdefaultÚhelpz-tz`time_cost`)r   r   r   z-mz`memory_cost`z-pz`parallelism`z-lz`hash_length`z	--profilez2A profile from `argon2.profiles. Takes precedence.r   s   secret)Ú	time_costÚmemory_costÚparallelismÚhash_lenZ
iterationsÚKiBÚthreadsÚbyteszRunning Argon2id %d times with:z	%s: %d %sr   z
Measuring...z
ph.verify(z, ú)zLfrom argon2 import PasswordHasher, Type

ph = PasswordHasher(
    time_cost=z,
    memory_cost=z,
    parallelism=z,
    hash_len=z,
)
gc.enable())ÚsetupÚnumberÚ
iè  z.1fzms per password verification)ÚargparseÚArgumentParserÚadd_argumentÚintr   r   r   r   ÚstrÚ
parse_argsZprofiler   Zfrom_parametersÚgetattrr	   ÚupperÚtÚmÚpÚlÚhashr   r   r   r   ÚprintÚnÚsortedÚitemsÚtimeit)
r   ÚparserÚargsÚpasswordÚphr)   ÚparamsÚkÚvÚduration© r7   úR/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/argon2/__main__.pyÚmain   sd    ÿÿÿÿÿüÿü
ü$
ôr9   Ú__main__)Ú
__future__r   r   Úsysr.   Ú r   r   r   r   r   r	   r9   Ú__name__r   r7   r7   r7   r8   Ú<module>   s    
F