B
    u9aö  ã               @   s„   d dddddddgZ dd	lZdd	lZdd	lZdd
lmZ ddlmZ eƒ Zej	Z
ejZdd„ ZdZddd„Zddd„Zddd„Zd	S )ÚchoiceÚ	randbelowÚrandbitsÚSystemRandomÚtoken_bytesÚ	token_hexÚtoken_urlsafeÚcompare_digesté    N)r   )r   c             C   s   | dkrt dƒ‚t | ¡S )Nr	   zUpper bound must be positive.)Ú
ValueErrorÚ_sysrandZ
_randbelow)Zexclusive_upper_bound© r   ú/usr/lib/python3.7/secrets.pyr      s    é    c             C   s   | d krt } t | ¡S )N)ÚDEFAULT_ENTROPYÚosÚurandom)Únbytesr   r   r   r   #   s    
c             C   s   t  t| ƒ¡ d¡S )NÚascii)ÚbinasciiZhexlifyr   Údecode)r   r   r   r   r   1   s    c             C   s   t | ƒ}t |¡ d¡ d¡S )Nó   =r   )r   Úbase64Zurlsafe_b64encodeÚrstripr   )r   Útokr   r   r   r   >   s    
)N)N)N)Ú__all__r   r   r   Zhmacr   Zrandomr   r   Zgetrandbitsr   r   r   r   r   r   r   r   r   r   r   Ú<module>	   s   

