
    I]0iH                    &   U d dl mZ d dlZd dlZd dlZd dlZd dlZdZdZ e	d ej
        ej        j        fD                       Zded<   dd	d
dhd  ed          D             d  ed          D             Zd$dZd%dZ	 d&d'dZd(dZd)d#ZdS )*    )annotationsN>abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789i@B c              #  *   K   | ]}||dk    
|V  d S )N/ ).0seps     D/var/www/html/venv/lib/python3.11/site-packages/werkzeug/security.py	<genexpr>r      s3        s3#::C::::     z	list[str]_os_alt_sepsCONPRNAUXNULc              #      K   | ]	}d | V  
dS )COMNr   r   is     r
   r   r      (      ##AiAii######r   
   c              #      K   | ]	}d | V  
dS )LPTNr   r   s     r
   r   r      r   r   lengthintreturnstrc                    | dk    rt          d          d                    d t          |           D                       S )zAGenerate a random string of SALT_CHARS with specified ``length``.r   zSalt length must be at least 1. c              3  H   K   | ]}t          j        t                    V  d S N)secretschoice
SALT_CHARS)r   _s     r
   r   zgen_salt.<locals>.<genexpr>   s,      EE!7>*--EEEEEEr   )
ValueErrorjoinrange)r   s    r
   gen_saltr)      sA    {{:;;;77EEuV}}EEEEEEr   methodsaltpasswordtuple[str, str]c                   |                      d          ^} }|                                }|                                }| dk    r|sd}d}d}n9	 t          t          |          \  }}}n# t          $ r t	          d          d w xY wd|z  |z  |z  }	t          j        ||||||	                                          d	| d| d| fS | d
k    rt          |          }
|
dk    r
d}t          }nI|
dk    r|d         }t          }n3|
dk    r|d         }t          |d                   }nt	          d          t          j
        ||||                                          d| d| fS t	          d|  d          )N:scrypti         z'scrypt' takes 3 arguments.   )r+   nrpmaxmemzscrypt:pbkdf2r   sha256   z'pbkdf2' takes 2 arguments.zpbkdf2:zInvalid hash method 'z'.)splitencodemapr   r&   hashlibr0   hexlenDEFAULT_PBKDF2_ITERATIONSpbkdf2_hmac)r*   r+   r,   args
salt_bytespassword_bytesr4   r5   r6   r7   len_args	hash_name
iterationss                r
   _hash_internalrI   !   s   LL%%MFTJ__&&N 	JAAAAJc4..1aa J J J !>??TIJ q1qNZ1Qv  cee!a!!!!!a!!	
 	
 
8		t99q== I2JJ]]QI2JJ]]QIT!WJJ:;;; >:z cee.i..*..	
 	
 ;;;;<<<s   A* *Br0      salt_lengthc                \    t          |          }t          |||           \  }}| d| d| S )aD  Securely hash a password for storage. A password can be compared to a stored hash
    using :func:`check_password_hash`.

    The following methods are supported:

    -   ``scrypt``, the default. The parameters are ``n``, ``r``, and ``p``, the default
        is ``scrypt:32768:8:1``. See :func:`hashlib.scrypt`.
    -   ``pbkdf2``, less secure. The parameters are ``hash_method`` and ``iterations``,
        the default is ``pbkdf2:sha256:600000``. See :func:`hashlib.pbkdf2_hmac`.

    Default parameters may be updated to reflect current guidelines, and methods may be
    deprecated and removed if they are no longer considered secure. To migrate old
    hashes, you may generate a new hash when checking an old hash, or you may contact
    users with a link to reset their password.

    :param password: The plaintext password.
    :param method: The key derivation function and parameters.
    :param salt_length: The number of characters to generate for the salt.

    .. versionchanged:: 3.1
        The default iterations for pbkdf2 was increased to 1,000,000.

    .. versionchanged:: 2.3
        Scrypt support was added.

    .. versionchanged:: 2.3
        The default iterations for pbkdf2 was increased to 600,000.

    .. versionchanged:: 2.3
        All plain hashes are deprecated and will not be supported in Werkzeug 3.0.
    $)r)   rI   )r,   r*   rK   r+   hactual_methods         r
   generate_password_hashrP   Q   sD    D K  D%fdH==A}((d((Q(((r   pwhashboolc                    	 |                      dd          \  }}}n# t          $ r Y dS w xY wt          j        t	          |||          d         |          S )aA  Securely check that the given stored password hash, previously generated using
    :func:`generate_password_hash`, matches the given password.

    Methods may be deprecated and removed if they are no longer considered secure. To
    migrate old hashes, you may generate a new hash when checking an old hash, or you
    may contact users with a link to reset their password.

    :param pwhash: The hashed password.
    :param password: The plaintext password.

    .. versionchanged:: 2.3
        All plain hashes are deprecated and will not be supported in Werkzeug 3.0.
    rM   r:   Fr   )r;   r&   hmaccompare_digestrI   )rQ   r,   r*   r+   hashvals        r
   check_password_hashrW   x   sk     &S! 4 4gg   uu ~fdHEEaH'RRRs    
++	directory	pathnames
str | Nonec                   | sd} | g}|D ]dk    rt          j                  t          fdt          D                       st          j        dk    r>t          j                                      d                                         t          v sOt          j        
                              s0                    d          sdk    s                    d          r d	S |                               t          j        | S )
a  Safely join zero or more untrusted path components to a base
    directory to avoid escaping the base directory.

    :param directory: The trusted base directory.
    :param pathnames: The untrusted path components relative to the
        base directory.
    :return: A safe path, otherwise ``None``.

    .. versionchanged:: 3.1.4
        Special device names are disallowed on Windows.
    .r   c              3      K   | ]}|v V  	d S r!   r   )r   r	   filenames     r
   r   zsafe_join.<locals>.<genexpr>   s'      88Cx888888r   ntr   r   z..z../N)	posixpathnormpathanyr   osnamepathsplitextupper_windows_device_filesisabs
startswithappendr'   )rX   rY   partsr^   s      @r
   	safe_joinrm      s"      	KE  r>> )(33H 8888<88888	 4G$$X..q17799=RRRw}}X&& S ""3''	 S
 4""5))   44X>5!!r   )r   r   r   r   )r*   r   r+   r   r,   r   r   r-   )r0   rJ   )r,   r   r*   r   rK   r   r   r   )rQ   r   r,   r   r   rR   )rX   r   rY   r   r   rZ   )
__future__r   r>   rT   rc   r`   r"   r$   rA   listr	   re   altsepr   __annotations__r(   rh   r)   rI   rP   rW   rm   r   r   r
   <module>rr      sz   " " " " " " "   				     M
% $  FBGN+         
				
 $#r### $#r### F F F F-= -= -= -=b ?A$) $) $) $) $)NS S S S,'" '" '" '" '" '"r   