HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/django/utils/__pycache__/crypto.cpython-310.pyc
o

3�aC�@s�dZddlZddlZddlZddlZddlmZddlmZddl	m
Z
Gdd�de�Zddd	�d
d�Z
e�ZdZeefd
d�Zdd�Zddd�ZdS)z3
Django's standard crypto functions and utilities.
�N)�settings)�RemovedInDjango40Warning)�force_bytesc@seZdZdZdS)�InvalidAlgorithmz&Algorithm is not supported by hashlib.N)�__name__�
__module__�__qualname__�__doc__�r
r
�5/usr/lib/python3/dist-packages/django/utils/crypto.pyrsr�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�>abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789cs4|turt�dt�d}d��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
    z.Not providing a length argument is deprecated.��c3s�|]}t���VqdS�N)�secrets�choice)�.0�i��
allowed_charsr
r�	<genexpr>Hs�z$get_random_string.<locals>.<genexpr>)�NOT_PROVIDED�warnings�warnr�join�range)�lengthr'r
r&r�get_random_string7s�r/cCst�t|�t|��S)z:Return True if the two strings are equal, False otherwise.)r"�compare_digestr)�val1�val2r
r
r�constant_time_compareKsr3cCs<|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�pbkdf2Psr;r!)rN)r	rrr"r*�django.confr�django.utils.deprecationr�django.utils.encodingr�
ValueErrorrr�objectr)�RANDOM_STRING_CHARSr/r3r;r
r
r
r�<module>s