o
    6dD                     @   s   d dl mZ 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mZmZ ddlmZ g dZdd
ededefddZdededefddZdededefddZ	ddededed
ededefddZdS )    )absolute_import)divisionN   )
__author____copyright__	__email____license____summary__	__title____uri____version__)_bcrypt)r
   r	   r   r   r   r   r   r   gensalthashpwkdfcheckpw      2broundsprefixreturnc                 C   s^   |dvrt d| dk s| dkrt dtd}t|}d| d d|  d	 d | S )
N)s   2ar   z%Supported prefixes are b'2a' or b'2b'      zInvalid rounds      $z%2.2uascii)
ValueErrorosurandomr   encode_base64encode)r   r   saltoutput r#   fC:\Users\jesus\OneDrive\Desktop\erpjis_fastapi\backend\jisbackend\Lib\site-packages\bcrypt/__init__.pyr   4   s$   

r   passwordr!   c                 C   s4   t | ts
t |trtd| d d } t| |S )N&Strings must be encoded before hashingH   )
isinstancestr	TypeErrorr   Zhashpass)r%   r!   r#   r#   r$   r   H   s   r   hashed_passwordc                 C   s2   t | ts
t |trtdt| |}t||S )Nz'Strings must be encoded before checking)r(   r)   r*   r   hmaccompare_digest)r%   r+   retr#   r#   r$   r   W   s   
r   Fdesired_key_bytesignore_few_roundsc                 C   s   t | ts
t |trtdt| dkst|dkrtd|dks&|dkr*td|dk r2td|dk rC|sCtjd	|td
d t	
| |||S )Nr&   r   z#password and salt must not be emptyi   zdesired_key_bytes must be 1-512r   zrounds must be 1 or more2   zrWarning: bcrypt.kdf() called with only {0} round(s). This few is not secure: the parameter is linear, like PBKDF2.   )
stacklevel)r(   r)   r*   lenr   warningswarnformatUserWarningr   Zpbkdf)r%   r!   r/   r   r0   r#   r#   r$   r   _   s    	r   )r   r   )F)
__future__r   r   r,   r   r5   	__about__r   r   r   r   r	   r
   r   r    r   __all__intbytesr   r   boolr   r   r#   r#   r#   r$   <module>   s2   (
