
    6iH                    ,   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y)    )annotationsN>abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789i@B c              #  2   K   | ]  }||dk7  s|  y w)N/ ).0seps     T/home/azureuser/techstart-app/venv/lib/python3.12/site-packages/werkzeug/security.py	<genexpr>r      s      s3#:Cs   z	list[str]_os_alt_sepsCONPRNAUXNULc              #  &   K   | ]	  }d |   yw)COMNr   r   is     r
   r   r           #AA3i#   
   c              #  &   K   | ]	  }d |   yw)LPTNr   r   s     r
   r   r      r   r   c                d    | dk  rt        d      dj                  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  N   K   | ]  }t        j                  t                y wN)secretschoice
SALT_CHARS)r   _s     r
   r   zgen_salt.<locals>.<genexpr>   s     E!7>>*-Es   #%)
ValueErrorjoinrange)lengths    r
   gen_saltr&      s.    {:;;77EuV}EEE    c                ~   | j                  d      ^} }|j                         }|j                         }| dk(  r]|sd}d}d}n	 t        t        |      \  }}}d|z  |z  |z  }	t        j                  ||||||	      j                         d	| d| d| fS | d
k(  r|t        |      }
|
dk(  r	d}t        }n5|
dk(  r|d   }t        }n$|
dk(  r|d   }t        |d         }nt	        d      t        j                  ||||      j                         d| d| fS t	        d|  d      # t        $ r t	        d      d w xY w)N:scrypti         z'scrypt' takes 3 arguments.   )saltnrpmaxmemzscrypt:pbkdf2r   sha256   z'pbkdf2' takes 2 arguments.zpbkdf2:zInvalid hash method 'z'.)splitencodemapintr"   hashlibr*   hexlenDEFAULT_PBKDF2_ITERATIONSpbkdf2_hmac)methodr.   passwordargs
salt_bytespassword_bytesr/   r0   r1   r2   len_args	hash_name
iterationss                r
   _hash_internalrG   !   s   LL%MFTJ__&NAAAJc4.1a q1qNNZ1QvceaS!AaS!	
 	
 
8	t9q= I2J]QI2J]QIT!WJ:;; >:zcei[*.	
 	
 0;<<A  J !>?TIJs   D& &D<c                L    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&   rG   )r@   r?   salt_lengthr.   hactual_methods         r
   generate_password_hashrM   Q   s9    D K D%fdH=A}_AdV1QC((r'   c                    	 | j                  dd      \  }}}t        j                  t	        |||      d   |      S # t        $ r Y yw xY w)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.
    rI   r5   Fr   )r6   r"   hmaccompare_digestrG   )pwhashr@   r?   r.   hashvals        r
   check_password_hashrS   x   sU     &S! 4g ~fdHEaH'RR  s   < 	AAc                   | sd} | g}|D ]  dk7  rt        j                        t        fdt        D              st        j
                  dk(  r6t        j                  j                        d   j                         t        v sFt        j                  j                        s'j                  d      sdk(  sj                  d      r y	|j                          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  
 y wr   r   )r   r	   filenames     r
   r   zsafe_join.<locals>.<genexpr>   s     8Cx8s   ntr   r   z..z../N)	posixpathnormpathanyr   osnamepathsplitextupper_windows_device_filesisabs
startswithappendr#   )	directory	pathnamespartsrW   s      @r
   	safe_joinrh      s      	KE r> ))(3H 8<884GG$$X.q1779=RRww}}X&""3'4""5)X%( >>5!!r'   )r%   r9   returnstr)r?   rj   r.   rj   r@   rj   ri   ztuple[str, str])r*      )r@   rj   r?   rj   rJ   r9   ri   rj   )rQ   rj   r@   rj   ri   bool)re   rj   rf   rj   ri   z
str | None)
__future__r   r:   rO   r\   rY   r   r    r=   listr	   r^   altsepr   __annotations__r$   ra   r&   rG   rM   rS   rh   r   r'   r
   <module>rq      s    "   	  M
%  FFBGGNN+ i  
				
 $r# $r# F-=b ?A$)$)$)8;$)$)NS,'"r'   