Ë
    àU.j¬5  ã                   ó(  — d Z ddlmZ ddlZ ej                  e«      ZddlmZm	Z	m
Z
 ddlmZ ddlmZmZ ddlmc mZ ddgZd	Zd
ZdZdZdZdd„Z G d„ dej6                  ej8                  «      Z G d„ dej<                  e«      Z G d„ de«      Z y)z0passlib.handlers.md5_crypt - md5-crypt algorithmé    )Úmd5N)Ú
safe_cryptÚ
test_cryptÚrepeat_string)Úh64)ÚunicodeÚuÚ	md5_cryptÚapr_md5_cryptó    s   $1$s   $apr1$))r   é   ©é   é   ©r   r   )r   é   r   r   ©r   r   )é   r   r   r   )r   r   r   r   r   )r   r   r   r   )r   r   r   r   r   )é   é   r   é   é   r   é   é   r   é   é	   r   r   é
   r   é   c                 óp  — t        | t        «      r| j                  d«      } t        | t        «      sJ d«       ‚t        | v r#t
        j                  j                  t        «      ‚t        | «      }t        |t        «      sJ d«       ‚|j                  d«      }t        |«      dk  sJ d«       ‚|rt        }nt        }t        | |z   | z   «      j                  «       }t        | |z   |z   «      }|j                  } |t        ||«      «       |}| dd }	|r ||dz  rt        n|	«       |dz  }|rŒ|j                  «       }
| | z   }| |z   }| |||| z   || z   ||z   g}t         D ��cg c]  \  }}||   ||   f‘Œ }}}|
}d	}|rH|D ];  \  }}t        |t        ||z   «      j                  «       z   «      j                  «       }Œ= |dz  }|rŒH|dd
 D ];  \  }}t        |t        ||z   «      j                  «       z   «      j                  «       }Œ= t#        j$                  |t&        «      j)                  d«      S c c}}w )a†  perform raw md5-crypt calculation

    this function provides a pure-python implementation of the internals
    for the MD5-Crypt algorithms; it doesn't handle any of the
    parsing/validation of the hash strings themselves.

    :arg pwd: password chars/bytes to hash
    :arg salt: salt chars to use
    :arg use_apr: use apache variant

    :returns:
        encoded checksum chars
    zutf-8zpwd not unicode or byteszsalt not unicodeÚasciir   zsalt too largeNr   é   é   )Ú
isinstancer   ÚencodeÚbytesÚ_BNULLÚuhÚexcÚNullPasswordErrorr
   ÚlenÚ
_APR_MAGICÚ
_MD5_MAGICr   ÚdigestÚupdater   Ú_c_digest_offsetsr   Úencode_transposed_bytesÚ_transpose_mapÚdecode)ÚpwdÚsaltÚuse_aprÚpwd_lenÚmagicÚdbÚa_ctxÚa_ctx_updateÚiÚevencharÚdaÚpwd_pwdÚpwd_saltÚpermsÚevenÚoddÚdataÚdcÚblockss                      ú\C:\xampp\htdocs\tradingbinance\backend\.venv\Lib\site-packages\passlib/handlers/md5_crypt.pyÚ_raw_md5_cryptrG   ,   sE  € ô4 �#”wÔØ�j‰j˜Ó!ˆÜ�cœ5Ô!Ð=Ð#=Ó=Ð!Ü��}Ü�f‰f×&Ñ&¤yÓ1Ð1Ü�#‹h€Gô �dœGÔ$Ð8Ð&8Ó8Ð$Ø�;‰;�wÓ€DÜˆt‹9�qŠ=Ð*Ð*Ó*ˆ=ñ Ü‰äˆô
 
ˆS�4‰Z˜#ÑÓ	×	%Ñ	%Ó	'€Bô ��e‘˜dÑ"Ó#€EØ—<‘<€Lñ ”˜r 7Ó+Ô,ð 	€AØ�2�Aˆw€HÙ
Ù˜q 1šu•V¨(Ô3Ø	ˆa‰ˆò ð
 
�‰‹€Bð\ �#‰g€GØ�4‰x€HØ�'˜8 X¨c¡\°4¸±8¸TÀ'¹\ÐJ€Eõ 9JÔJÑ8I©9¨4°ˆe�D‰k˜5 ™:Ò&Ð8I€DÑJð 
€BØ€FÙ
Û‰IˆD�#Ü�Sœ3˜r D™y›>×0Ñ0Ó2Ñ2Ó3×:Ñ:Ó<‰Bð à�!‰ˆò ð ˜#˜2“Y‰	ˆˆcÜ�”s˜2 ™9“~×,Ñ,Ó.Ñ.Ó/×6Ñ6Ó8‰ð ô ×&Ñ& r¬>Ó:×AÑAÀ'ÓJÐJùó# Ks   Å!H2c                   ób   — e Zd ZdZdZdZej                  ZdZ	ej                  Z
ed„ «       Zd„ Zy)Ú_MD5_Commonz+common code for md5_crypt and apr_md5_crypt)r4   Ú	salt_sizeé   r   c                 ó`   — t        j                  || j                  | ¬«      \  }} | ||¬«      S )N)Úhandler)r4   Úchecksum)r'   Ú	parse_mc2Úident)ÚclsÚhashr4   Úchks       rF   Úfrom_stringz_MD5_Common.from_stringÒ   s)   € ä—L‘L  s§y¡y¸#Ô>‰	ˆˆcÙ˜ sÔ+Ð+ó    c                 ól   — t        j                  | j                  | j                  | j                  «      S ©N)r'   Ú
render_mc2rP   r4   rN   )Úselfs    rF   Ú	to_stringz_MD5_Common.to_string×   s!   € Ü�}‰}˜TŸZ™Z¨¯©°D·M±MÓBÐBrU   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úsetting_kwdsÚchecksum_sizer'   ÚHASH64_CHARSÚchecksum_charsÚmax_salt_sizeÚ
salt_charsÚclassmethodrT   rZ   © rU   rF   rI   rI   À   sB   „ Ù5ð
 )€Là€MØ—_‘_€Nà€MØ—‘€Jð ñ,ó ð,óCrU   rI   c                   óT   — e Zd ZdZd Z ed«      ZdZed„ «       Z	d„ Z
ed„ «       Zd„ Zy)	r
   a•  This class implements the MD5-Crypt password hash, and follows the :ref:`password-hash-api`.

    It supports a variable-length salt.

    The :meth:`~passlib.ifc.PasswordHash.using` method accepts the following optional keywords:

    :type salt: str
    :param salt:
        Optional salt string.
        If not specified, one will be autogenerated (this is recommended).
        If specified, it must be 0-8 characters, drawn from the regexp range ``[./0-9A-Za-z]``.

    :type salt_size: int
    :param salt_size:
        Optional number of characters to use when autogenerating new salts.
        Defaults to 8, but can be any value between 0 and 8.
        (This is mainly needed when generating Cisco-compatible hashes,
        which require ``salt_size=4``).

    :type relaxed: bool
    :param relaxed:
        By default, providing an invalid value for one of the other
        keywords will result in a :exc:`ValueError`. If ``relaxed=True``,
        and the error can be corrected, a :exc:`~passlib.exc.PasslibHashWarning`
        will be issued instead. Correctable errors include
        ``salt`` strings that are too long.

        .. versionadded:: 1.6
    z$1$)Úos_cryptÚbuiltinc                 óT   — t        dd«      r| j                  | j                  «       yy)NÚtestz$1$test$pi/xDtU5WFVRqYS6BMU8X/TF)r   Ú_set_calc_checksum_backendÚ_calc_checksum_os_crypt©rQ   s    rF   Ú_load_backend_os_cryptz md5_crypt._load_backend_os_crypt  s'   € ä�fÐ>Ô?Ø×*Ñ*¨3×+FÑ+FÔGØàrU   c                 ó  — | j                   | j                  z   }t        ||«      }|€| j                  |«      S |j	                  |«      rt        |«      t        |«      dz   k7  r!t        j                  j                  | ||«      ‚|dd  S )Nr!   iêÿÿÿ)	rP   r4   r   Ú_calc_checksum_builtinÚ
startswithr*   r'   r(   ÚCryptBackendError)rY   ÚsecretÚconfigrR   s       rF   rm   z!md5_crypt._calc_checksum_os_crypt  s}   € Ø—‘˜dŸi™iÑ'ˆÜ˜& &Ó)ˆØˆ<ð ×.Ñ.¨vÓ6Ð6Ø�‰˜vÔ&¬#¨d«)´s¸6³{ÀRÑ7GÒ*GÜ—&‘&×*Ñ*¨4°¸Ó>Ð>Ø�C�DˆzÐrU   c                 ó:   — | j                  | j                  «       y)NT)rl   rq   rn   s    rF   Ú_load_backend_builtinzmd5_crypt._load_backend_builtin%  s   € à×&Ñ& s×'AÑ'AÔBØrU   c                 ó.   — t        || j                  «      S rW   ©rG   r4   ©rY   rt   s     rF   rq   z md5_crypt._calc_checksum_builtin*  s   € Ü˜f d§i¡iÓ0Ð0rU   N)r[   r\   r]   r^   Únamer	   rP   Úbackendsre   ro   rm   rw   rq   rf   rU   rF   r
   r
   à   sQ   „ ñð@ €DÙˆe‹H€Eð '€Hð
 ñó ðò	ð ñó ðó1rU   c                   ó*   — e Zd ZdZd Z ed«      Zd„ Zy)r   ap  This class implements the Apr-MD5-Crypt password hash, and follows the :ref:`password-hash-api`.

    It supports a variable-length salt.

    The :meth:`~passlib.ifc.PasswordHash.using` method accepts the following optional keywords:

    :type salt: str
    :param salt:
        Optional salt string.
        If not specified, one will be autogenerated (this is recommended).
        If specified, it must be 0-8 characters, drawn from the regexp range ``[./0-9A-Za-z]``.

    :type relaxed: bool
    :param relaxed:
        By default, providing an invalid value for one of the other
        keywords will result in a :exc:`ValueError`. If ``relaxed=True``,
        and the error can be corrected, a :exc:`~passlib.exc.PasslibHashWarning`
        will be issued instead. Correctable errors include
        ``salt`` strings that are too long.

        .. versionadded:: 1.6
    z$apr1$c                 ó2   — t        || j                  d¬«      S )NT)r5   ry   rz   s     rF   Ú_calc_checksumzapr_md5_crypt._calc_checksumQ  s   € Ü˜f d§i¡i¸Ô>Ð>rU   N)r[   r\   r]   r^   r{   r	   rP   r   rf   rU   rF   r   r   1  s   „ ñð2 €DÙˆh‹K€Eó
?rU   )F)!r^   Úhashlibr   ÚloggingÚ	getLoggerr[   ÚlogÚpasslib.utilsr   r   r   Úpasslib.utils.binaryr   Úpasslib.utils.compatr   r	   Úpasslib.utils.handlersÚutilsÚhandlersr'   Ú__all__r&   r,   r+   r/   r1   rG   ÚHasSaltÚGenericHandlerrI   ÚHasManyBackendsr
   r   rf   rU   rF   Ú<module>rŽ      s­   ðÙ 6õ
 Û Ð'�g×'Ñ'¨Ó1�÷ @Ñ ?Ý $ß +ß #Ð #ð Øð€ð 
€Ø€
Ø€
ðÐ ð H€óOKôhC�"—*‘*˜b×/Ñ/ô Cô@K1�×"Ñ" Kô K1ôb!?�Kõ !?rU   