
    i                     @    d Z ddlZdedefdZdedefdZdedefdZy)	z6Password verification and bcrypt hashing for usuarios.    Nstoredreturnc                 H    t        | t              xr | j                  d      S )Nz$2)
isinstancestr
startswith)r   s    :C:\Users\joaquim\OneDrive\LojaOnline\services\passwords.pypassword_is_bcryptr
      s    fc">v'8'8'>>    plainc                     || yt        | t              r| j                  dd      } t        |       r5	 t	        j
                  |j                  d      | j                  d            S | |k(  S # t        $ r Y yw xY w)NFutf-8replace)errors)r   bytesdecoder
   bcryptcheckpwencode	Exception)r   r   s     r	   verify_passwordr   
   sz    }&% wy9&!	>>%,,w"7w9OPP U?  		s   3A. .	A:9A:c                     t        j                  | j                  d      t        j                               j	                  d      S )Nr   )r   hashpwr   gensaltr   )r   s    r	   hash_passwordr      s.    ==g.0@AHHQQr   )__doc__r   r   boolr
   r   r    r   r	   <module>r      sG    < ?s ?t ?
3 
4 
R R Rr   