ó
    ½RjË  ã                   ó  • S r SSKrSSKrSSKrSSKJr  SSKJr  SSKJ	r	   " S S\
5      rSSS	.S
 jjrSr\4S jrS rSS jr\	" \R"                  S5      (       a  \R"                  r\R$                  rgSSS.S jjrSS.S jrg)z3
Django's standard crypto functions and utilities.
é    N)Úsettings)Úforce_bytes)Úfunc_supports_parameterc                   ó   • \ rS rSrSrSrg)ÚInvalidAlgorithmé   z&Algorithm is not supported by hashlib.© N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú__static_attributes__r	   ó    Ú?D:\diplom_project\venv\Lib\site-packages\django/utils/crypto.pyr   r      s   † Ù0âr   r   Úsha1)Ú	algorithmc                ó&  • Uc  [         R                  n[        U 5      n [        U5      n [        [        U5      nU" X-   5      R                  5       n[        R                  " U[        U5      US9$ ! [
         a  n[        SU-  5      UeSnAff = f)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ðÜœ )Ó,ˆñ �Ñ"Ó
#×
*Ñ
*Ó
,€Cô
 �8Š8�Cœ[¨Ó/¸6ÑBÐBøô ó ÜØDÀyÑPó
àð	ûðús   «A2 Á2
BÁ<BÂBÚ>abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789c                 óL   ^• SR                  U4S j[        U 5       5       5      $ )a+  
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   óP   >#   • U  H  n[         R                  " T5      v •  M     g 7f©N)ÚsecretsÚchoice)Ú.0ÚiÚallowed_charss     €r   Ú	<genexpr>Ú$get_random_string.<locals>.<genexpr>>   s   øé € ÐHº-°Q”7—>’> -×0Ð0º-ùs   ƒ#&)ÚjoinÚrange)Úlengthr.   s    `r   Úget_random_stringr4   3   s   ø€ ð �7‰7ÔH¼%À¼-ÓHÓHÐHr   c                 óT   • [         R                  " [        U 5      [        U5      5      $ )z:Return True if the two strings are equal, False otherwise.)r*   Úcompare_digestr   )Úval1Úval2s     r   Úconstant_time_comparer9   A   s   € ä×!Ò!¤+¨dÓ"3´[ÀÓ5FÓGÐGr   c                 ó¸   • Uc  [         R                  nU=(       d    Sn[        U 5      n [        U5      n[         R                  " U" 5       R                  XX#5      $ )z)Return the hash of password using pbkdf2.N)r   Úsha256r   Úpbkdf2_hmacÚname)ÚpasswordÚsaltÚ
iterationsÚdklenr   s        r   Úpbkdf2rB   F   sH   € à�~Ü—‘ˆØ�M�T€EÜ˜8Ó$€HÜ�tÓ€DÜ×Ò™v›xŸ}™}¨h¸jÓPÐPr   ÚusedforsecurityT)rC   c                ó.   • [         R                  " U 5      $ r)   )r   Úmd5)ÚdatarC   s     r   rE   rE   Y   s   € Ü�{Š{˜4Ó Ð r   c                ó.   • [         R                  " U 5      $ r)   )r   r   )Úhash_algorithmrC   s     r   Únew_hashrI   \   s   € Ü�{Š{˜>Ó*Ð*r   r)   )r   N)r   )r   r   r   r*   Údjango.confr   Údjango.utils.encodingr   Údjango.utils.inspectr   Ú
ValueErrorr   r$   ÚRANDOM_STRING_CHARSr4   r9   rB   rE   r   rI   r	   r   r   Ú<module>rO      s•   ðñó Û Û å  Ý -Ý 8ô	�zô 	ðC¸6ö Cð: WÐ ð -@ô IòHô
Qñ ˜7Ÿ;™;Ð(9×:Ñ:Ø
�+‰+€CØ�{‰{�Hð!¨ö !ð 59ö +r   