Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
security.cpython-313.pyc106 linesDownload Raw Back to __pycache__
1�

2��j����%SSKJr SSKrSSKrSSKrSSKrSSKrSrSr\	"S\R\R455rS\
S'SS	S3S1SS
5kSS
5kSiSirSSjrSSjrSSSjjrSSjrSSjrg)�)�annotationsN�>abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789i@Bc#�># �UHocMUS:wdMUv� M g7f)N�/�)�.0�seps  �WD:\code\apps\devtools\python\user_packages\Python313\site-packages\werkzeug/security.py�	<genexpr>rs����&�C�C�c�S�j�C�C�&�s���	z	list[str]�_os_alt_seps�AUX�CONzCONIN$zCONOUT$c#�,# �UH4nSU3v� M g7f)�COMNr�r�cs  r5rr����+�*�A��A�3�i�*���u123456789¹²³c#�,# �UH6nSU3v� M g7f)�LPTNrrs  r7rrrr�NUL�PRNc�f�US::a[S5eSRS[U555$)zAGenerate a random string of SALT_CHARS with specified ``length``.rzSalt length must be at least 1.�c3�V# �UHn[R"[5v� M! g7f�N)�secrets�choice�8SALT_CHARS)r�_s  r9r�gen_salt.<locals>.<genexpr>!s���E�}�!�7�>�>�*�-�-�}�s�'))�10ValueError�join�range)�lengths r11�gen_saltr&s.��
��{��:�;�;�
�7�7�E�u�V�}�E�E�E�c	��URS5tpUR5nUR5nUS:Xa\U(dSnSnSnO[[U5upgnSU-U-U-n	[12R"XTXgX�S9R5S	USUSU34$US13:Xa~[U5n14U15S:Xa	Sn[nO7U16S:XaUSn[nO%U17S
:XaUSn[US5nO[	S5e[18R"X�XL5R5SUSU34$[	SUS35e![a
 [	S5Sef=f)N�:�scrypti���z'scrypt' takes 3 arguments.�)�salt�n�r�p�maxmemzscrypt:�pbkdf2r�sha256�z'pbkdf2' takes 2 arguments.zpbkdf2:zInvalid hash method 'z'.)�split�encode�map�intr"�hashlibr*�hex�len�DEFAULT_PBKDF2_ITERATIONS�pbkdf2_hmac)
�methodr.�password�args�19salt_bytes�password_bytesr/r0r1r2�len_args�	hash_name�20iterationss
             r21�_hash_internalrG$sv���L�L��%�M�F�����J��_�_�&�N�
�����A��A��A�
J��c�4�.���a��q��1��q����N�N��1�Q�
��c�e��a�S��!��A�a�S�!�	22�	23�24�8�	��t�9���q�=� �I�2�J�
��]��Q��I�2�J�
��]��Q��I��T�!�W��J��:�;�;�
����:�
��c�e��i�[��*��.�	25�	26��0����;�<�<��A�
J� �!>�?�T�I�
J�s�D(�(D?c�H�[U5n[XU5upEUSUSU3$)a�Securely hash a password for storage. A password can be compared to a stored hash27using :func:`check_password_hash`.28 29The following methods are supported:30 31-   ``scrypt``, the default. The parameters are ``n``, ``r``, and ``p``, the default32    is ``scrypt:32768:8:1``. See :func:`hashlib.scrypt`.33-   ``pbkdf2``, less secure. The parameters are ``hash_method`` and ``iterations``,34    the default is ``pbkdf2:sha256:600000``. See :func:`hashlib.pbkdf2_hmac`.35 36Default parameters may be updated to reflect current guidelines, and methods may be37deprecated and removed if they are no longer considered secure. To migrate old38hashes, you may generate a new hash when checking an old hash, or you may contact39users with a link to reset their password.40 41:param password: The plaintext password.42:param method: The key derivation function and parameters.43:param salt_length: The number of characters to generate for the salt.44 45.. versionchanged:: 3.146    The default iterations for pbkdf2 was increased to 1,000,000.47 48.. versionchanged:: 2.349    Scrypt support was added.50 51.. versionchanged:: 2.352    The default iterations for pbkdf2 was increased to 600,000.53 54.. versionchanged:: 2.355    All plain hashes are deprecated and will not be supported in Werkzeug 3.0.56�$)r&rG)r@r?�salt_lengthr.�h�
actual_methods      r57�generate_password_hashrMTs5��D�K� �D�%�f�H�=��A��_�A�d�V�1�Q�C�(�(r'c��URSS5up#n[R"[	X#U5SU5$![a gf=f)aSecurely check that the given stored password hash, previously generated using58:func:`generate_password_hash`, matches the given password.59 60Methods may be deprecated and removed if they are no longer considered secure. To61migrate old hashes, you may generate a new hash when checking an old hash, or you62may contact users with a link to reset their password.63 64:param pwhash: The hashed password.65:param password: The plaintext password.66 67.. versionchanged:: 2.368    All plain hashes are deprecated and will not be supported in Werkzeug 3.0.69rIr5Fr)r6r"�hmac�compare_digestrG)�pwhashr@r?r.�hashvals     r70�check_password_hashrS{sQ��� &���S�!� 4���g����~�f�H�E�a�H�'�R�R������s�;�71A�Ac�^�U(dSnU/nUH�mT(dM[R"T5m[RR	T5(d�TRS5(dtTS:XdnTRS5(dX[
U4Sj[55(d:[RS:Xa([
STRS555(a gURT5 M� [R"U6$)	aXSafely join zero or more untrusted path components to a trusted base72directory to avoid escaping the base directory.73 74The untrusted path is assumed to be from/for a URL, such as for serving75files. Therefore, it should only use the forward slash ``/`` path separator,76and will be joined using that separator. On Windows, the backslash ``\``77separator is not allowed.78 79:param directory: The trusted base directory.80:param untrusted: The untrusted path components relative to the81    base directory.82:return: A safe path, otherwise ``None``.83 84.. versionchanged:: 3.1.685    Special device names in multi-segment paths are not allowed on Windows.86 87.. versionchanged:: 3.1.588    More special device names, regardless of extension or trailing spaces,89    are not allowed on Windows.90 91.. versionchanged:: 3.1.492    Special device names are not allowed on Windows.93�.rz..z../c3�,># �UH	oT;v� M g7frr)rr	�parts  �r94r�safe_join.<locals>.<genexpr>�s����7�,�3�$�;�,�s��ntc3�# �UH<nURS5SR5R5[;v� M> g7f)rUrN)�	partition�strip�upper�_windows_device_files)rr1s  r95rrX�s=����,���K�K��$�Q�'�-�-�/�5�5�7�;P�P�,�s�AAN)�	posixpath�normpath�os�path�isabs�96startswith�anyr�namer6�appendr#)�	directory�	untrusted�partsrWs   @r97�	safe_joinrk�s����0��	�
�K�E������!�!�$�'��
�G�G�M�M�$������s�#�#��t�|����u�%�%��7�,�7�7�7����4����!�Z�Z��_�����
���T��/�2�>�>�5�!�!r')r%r9�return�str)r?rmr.rmr@rmrlztuple[str, str])r*�)r@rmr?rmrJr9rlrm)rQrmr@rmrl�bool)rhrmrirmrlz98str | None)�99__future__rr:rOrar_rrr=�listr	�altsepr�__annotations__r^r&rGrMrSrkrr'r100�<module>rts���"���	���
M�101�%�����F�F�B�I�I�&����i��102103�	��
�		�104,�*�+�	�,�*�+�
	�105�	�106�	��F�-=�b?A�$)��$)��$)�8;�$)��$)�NS�,8"r'
codekingpro/portable-devtools · Team Ai