https://t.me/AnonymousX5
Server : Apache
System : Linux cvar2.toservers.com 3.10.0-962.3.2.lve1.5.73.el7.x86_64 #1 SMP Wed Aug 24 21:31:23 UTC 2022 x86_64
User : njnconst ( 1116)
PHP Version : 8.4.18
Disable Function : NONE
Directory :  /usr/lib/python2.7/site-packages/werkzeug/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/lib/python2.7/site-packages/werkzeug/security.pyc
�
./�_c@s�dZddlZddlZddlZddlZddlZddlmZddlm	Z	ddl
mZddl
mZddl
m
Z
dd	l
mZdd
l
mZddl
mZdZd
Ze	d�jZeedd�Ze�Zed�ejjejjgD��Zeddd�Zeddd�Zd�Z d�Z!d�Z"d�Z#ddd�Z$d�Z%d�Z&dS(s�
    werkzeug.security
    ~~~~~~~~~~~~~~~~~

    Security related helpers such as secure password hashing tools.

    :copyright: 2007 Pallets
    :license: BSD-3-Clause
i����N(tSystemRandom(tStructi(tizip(tPY2(t
range_type(t	text_type(tto_bytes(t	to_nativet>abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789i�Is>Itcompare_digestccs!|]}|dkr|VqdS(t/N(NR
(tNone(t.0tsep((s5/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/security.pys	<genexpr>!scCs.t|||||�}ttj|d��S(s)Like :func:`pbkdf2_bin`, but returns a hex-encoded string.

    .. versionadded:: 0.9

    :param data: the data to derive.
    :param salt: the salt for the derivation.
    :param iterations: the number of iterations.
    :param keylen: the length of the resulting key.  If not provided,
                   the digest size will be used.
    :param hashfunc: the hash function to use.  This can either be the
                     string name of a known hash function, or a function
                     from the hashlib module.  Defaults to sha256.
    t	hex_codec(t
pbkdf2_binRtcodecstencode(tdatatsaltt
iterationstkeylenthashfunctrv((s5/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/security.pyt
pbkdf2_hex%scCsp|sd}nt|�}t|�}t|�rQ|�}t|dd�}n|}tj|||||�S(s�Returns a binary digest for the PBKDF2 hash algorithm of `data`
    with the given `salt`. It iterates `iterations` times and produces a
    key of `keylen` bytes. By default, SHA-256 is used as hash function;
    a different hashlib `hashfunc` can be provided.

    .. versionadded:: 0.9

    :param data: the data to derive.
    :param salt: the salt for the derivation.
    :param iterations: the number of iterations.
    :param keylen: the length of the resulting key.  If not provided
                   the digest size will be used.
    :param hashfunc: the hash function to use.  This can either be the
                     string name of a known hash function or a function
                     from the hashlib module.  Defaults to sha256.
    tsha256tnameN(RtcallabletgetattrRthashlibtpbkdf2_hmac(RRRRRt
_test_hasht	hash_name((s5/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/security.pyR9s		cCs�t|t�r!|jd�}nt|t�rB|jd�}ntdk	r[t||�St|�t|�krwtSd}tr�xht||�D]&\}}|t	|�t	|�AO}q�Wn.x+t||�D]\}}|||AO}q�W|dkS(s�This function compares strings in somewhat constant time.  This
    requires that the length of at least one string is known in advance.

    Returns `True` if the two strings are equal, or `False` if they are not.

    .. versionadded:: 0.7
    sutf-8iN(
t
isinstanceRRt_builtin_safe_str_cmpRtlentFalseRRtord(tatbRtxty((s5/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/security.pytsafe_str_cmpZs
!cCs8|dkrtd��ndjd�t|�D��S(sAGenerate a random string of SALT_CHARS with specified ``length``.isSalt length must be positivetcss|]}tjt�VqdS(N(t_sys_rngtchoicet
SALT_CHARS(Rt_((s5/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/security.pys	<genexpr>|s(t
ValueErrortjoinR(tlength((s5/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/security.pytgen_saltxsc		Csp|dkr||fSt|t�r7|jd�}n|jd�r�|djd�}t|�d
krztd��n|jd	�}|r�t|d	p�d	�p�t	}t
}d
||f}nt}|}|r|s�td��nt|||d|�}n`|rNt|t�r-|jd�}nt
|||�}|j�}ntj||�j�}||fS(s�Internal password hash helper.  Supports plaintext without salt,
    unsalted and salted passwords.  In case salted passwords are used
    hmac is used.
    tplainsutf-8spbkdf2:it:iis&Invalid number of arguments for PBKDF2ispbkdf2:%s:%dsSalt is required for PBKDF2R(ii(R!RRt
startswithtsplitR#R0tpoptinttDEFAULT_PBKDF2_ITERATIONStTrueR$Rt_create_mact	hexdigestRtnew(	tmethodRtpasswordtargsRt	is_pbkdf2t
actual_methodRtmac((s5/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/security.pyt_hash_internals2
"csMt��rtj||��Sd�fd�}||_tj|||�S(NR+cstj�|�S(N(RR>(td(R?(s5/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/security.pyR�s(RthmactHMACt__call__(tkeytmsgR?R((R?s5/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/security.pyR<�s
	s
pbkdf2:sha256icCsG|dkrt|�nd}t|||�\}}d|||fS(s�Hash a password with the given method and salt with a string of
    the given length. The format of the string returned includes the method
    that was used so that :func:`check_password_hash` can check the hash.

    The format for the hashed string looks like this::

        method$salt$hash

    This method can **not** generate unsalted passwords but it is possible
    to set param method='plain' in order to enforce plaintext passwords.
    If a salt is used, hmac is used internally to salt the password.

    If PBKDF2 is wanted it can be enabled by setting the method to
    ``pbkdf2:method:iterations`` where iterations is optional::

        pbkdf2:sha256:80000$salt$hash
        pbkdf2:sha256$salt$hash

    :param password: the password to hash.
    :param method: the hash method to use (one that hashlib supports). Can
                   optionally be in the format ``pbkdf2:<method>[:iterations]``
                   to enable PBKDF2.
    :param salt_length: the length of the salt in letters.
    R4R+s%s$%s$%s(R3RE(R@R?tsalt_lengthRthRC((s5/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/security.pytgenerate_password_hash�scCsQ|jd�dkrtS|jdd�\}}}tt|||�d|�S(s�check a password against a given salted and hashed password value.
    In order to support unsalted legacy passwords this method supports
    plain text passwords, md5 and sha1 hashes (both salted and unsalted).

    Returns `True` if the password matched, `False` otherwise.

    :param pwhash: a hashed string like returned by
                   :func:`generate_password_hash`.
    :param password: the plaintext password to compare against the hash.
    t$ii(tcountR$R7R*RE(tpwhashR@R?Rthashval((s5/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/security.pytcheck_password_hash�scs�|g}x�|D]~��dkr4tj���nt�fd�tD��s}tjj��s}�dks}�jd�r�dS|j	��qWtj
|�S(s2Safely 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``.
    R+c3s|]}|�kVqdS(N((RR
(tfilename(s5/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/security.pys	<genexpr>�ss..s../N(t	posixpathtnormpathtanyt_os_alt_sepstostpathtisabsR6RtappendR1(t	directoryt	pathnamestparts((RTs5/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/security.pyt	safe_join�s		
('t__doc__RRRGRYRUtrandomRtstructRt_compatRRRRRRR.R:tpackt	_pack_intRRR"R,tlistRZR
taltsepRXRRR*R3RER<RNRSR`(((s5/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/security.pyt<module>
s:	% 			%	
	

https://t.me/AnonymousX5 - 2025