HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: xnsbb3110 (1041)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/CyberPanel/lib/python3.10/site-packages/django/utils/__pycache__/crypto.cpython-310.pyc
o

�h��@s�dZddlZddlZddlZddlmZddlmZddlm	Z	Gdd�de
�Zddd	�d
d�ZdZ
e
fd
d�Zdd�Zddd�Ze	ejd�rOejZejZdSddd�dd�Zdd�dd�ZdS)z3
Django's standard crypto functions and utilities.
�N)�settings)�force_bytes)�func_supports_parameterc@seZdZdZdS)�InvalidAlgorithmz&Algorithm is not supported by hashlib.N)�__name__�
__module__�__qualname__�__doc__�r
r
�I/usr/local/CyberPanel/lib/python3.10/site-packages/django/utils/crypto.pyr
sr�sha1)�	algorithmc
Csx|durtj}t|�}t|�}ztt|�}Wnty)}ztd|�|�d}~ww|||���}tj	|t|�|d�S)a*
    Return the HMAC of 'value', using a key generated from key_salt and a
    secret (which defaults to settings.SECRET_KEY). Default algorithm is SHA1,
    but any algorithm name supported by hashlib can be passed.

    A different key_salt should be passed in for every application of HMAC.
    Nz6%r is not an algorithm accepted by the hashlib module.)�msg�	digestmod)
r�
SECRET_KEYr�getattr�hashlib�AttributeErrorr�digest�hmac�new)�key_salt�value�secretr
�hasher�e�keyr
r
r�salted_hmacs ����r�>abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789csd��fdd�t|�D��S)aG
    Return a securely generated random string.

    The bit length of the returned value can be calculated with the formula:
        log_2(len(allowed_chars)^length)

    For example, with default `allowed_chars` (26+26+10), this gives:
      * length: 12, bit length =~ 71 bits
      * length: 22, bit length =~ 131 bits
    �c3s�|]}t���VqdS�N)�secrets�choice)�.0�i��
allowed_charsr
r�	<genexpr>>s�z$get_random_string.<locals>.<genexpr>)�join�range)�lengthr&r
r%r�get_random_string3sr+cCst�t|�t|��S)z:Return True if the two strings are equal, False otherwise.)r!�compare_digestr)�val1�val2r
r
r�constant_time_compareAsr/cCs<|durtj}|p
d}t|�}t|�}t�|�j||||�S)z)Return the hash of password using pbkdf2.N)r�sha256r�pbkdf2_hmac�name)�password�salt�
iterations�dklenrr
r
r�pbkdf2Fsr7�usedforsecurity�T)r8cC�
t�|�Sr )r�md5)�datar8r
r
rr;Y�
r;cCr:r )rr)�hash_algorithmr8r
r
r�new_hash\r=r?r )rN)r9)r	rrr!�django.confr�django.utils.encodingr�django.utils.inspectr�
ValueErrorrr�RANDOM_STRING_CHARSr+r/r7r;rr?r
r
r
r�<module>s$