Ë
    ¹ûàgf
  ã                   óx   — d Z ddlZddlZddlZddlmZ ddlmZ  G d„ de«      Z	dddœd	„Z
d
Zefd„Zd„ Zdd„Zy)z3
Django's standard crypto functions and utilities.
é    N)Úsettings)Úforce_bytesc                   ó   — e Zd ZdZy)ÚInvalidAlgorithmz&Algorithm is not supported by hashlib.N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__© ó    úQ/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/django/utils/crypto.pyr   r      s   „ Ù0àr   r   Úsha1)Ú	algorithmc                ó(  — |€t         j                  }t        | «      } t        |«      }	 t        t        |«      } || |z   «      j                  «       }t        j                  |t        |«      |¬«      S # t
        $ r}t        d|z  «      |‚d}~ww xY w)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Úkeys          r   Úsalted_hmacr       s—   € ð €~Ü×$Ñ$ˆä˜8Ó$€HÜ˜Ó €FðÜœ )Ó,ˆñ �˜FÑ"Ó
#×
*Ñ
*Ó
,€Cô
 �8‰8�Cœ[¨Ó/¸6ÔBÐBøô ò ÜØDÀyÑPó
àð	ûðús   ªA4 Á4	BÁ=BÂBÚ>abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789c                 óJ   ‡— dj                  ˆfd„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
    Ú c              3   óH   •K  — | ]  }t        j                  ‰«      –— Œ y ­w©N)ÚsecretsÚchoice)Ú.0ÚiÚallowed_charss     €r   ú	<genexpr>z$get_random_string.<locals>.<genexpr>>   s   øè ø€ ÒH°Q”7—>‘> -×0ÑHùs   ƒ")ÚjoinÚrange)Úlengthr*   s    `r   Úget_random_stringr/   3   s   ø€ ð �7‰7ÓH¼%À»-ÔHÓHÐHr   c                 óR   — t        j                  t        | «      t        |«      «      S )z:Return True if the two strings are equal, False otherwise.)r&   Úcompare_digestr   )Úval1Úval2s     r   Úconstant_time_comparer4   A   s   € ä×!Ñ!¤+¨dÓ"3´[ÀÓ5FÓGÐGr   c                 ó®   — |€t         j                  }|xs d}t        | «      } t        |«      }t        j                   |«       j                  | |||«      S )z)Return the hash of password using pbkdf2.N)r   Úsha256r   Úpbkdf2_hmacÚname)ÚpasswordÚsaltÚ
iterationsÚdklenr   s        r   Úpbkdf2r=   F   sL   € à€~Ü—‘ˆØŠM�T€EÜ˜8Ó$€HÜ�tÓ€DÜ×Ñ™v›xŸ}™}¨h¸¸jÈ%ÓPÐPr   r%   )r   N)r
   r   r   r&   Údjango.confr   Údjango.utils.encodingr   Ú
ValueErrorr   r    ÚRANDOM_STRING_CHARSr/   r4   r=   r   r   r   ú<module>rB      sV   ðñó Û Û å  Ý -ô	�zô 	ðC¸6ô Cð: WÐ ð -@ó IòHô
Qr   