§
    HŠtjBJ  ã                   óú  — d Z ddlmZmZ ddlmZmZ ddlZ ej        e	¦  «        Z
ddlmZ ddlmZmZ ddlmZmZmZmZ ddlmZ ddlmc mZ g d	¢Z G d
„ dej        ej        ej        ej        ¦  «        Z dde	fd„Z! e!ddd ed¦  «        ¬¦  «        Z" e!ddd¦  «        Z# e!ddd¦  «        Z$ ej%        de"ddd¬¦  «        Z& ej%        de#ddd¬¦  «        Z' ej%        de$d d!d¬¦  «        Z(d"Z) G d#„ d$ej        ej        ej        ej        ¦  «        Z* G d%„ d&ej        ej+        ej        ¦  «        Z, G d'„ d(ej        ej        ej        ¦  «        Z- G d)„ d*ej        ej        ej        ej        ¦  «        Z.dS )+z,passlib.handlers.pbkdf - PBKDF2 based hashesé    )ÚhexlifyÚ	unhexlify)Ú	b64encodeÚ	b64decodeN)Ú
to_unicode)Úab64_decodeÚab64_encode)Ústr_to_basciiÚuÚuascii_to_strÚunicode)Úpbkdf2_hmac)Úpbkdf2_sha1Úpbkdf2_sha256Úpbkdf2_sha512Úcta_pbkdf2_sha1Údlitz_pbkdf2_sha1Úgrub_pbkdf2_sha512c                   ób   — e Zd ZdZdZej        ZdZdZ	dZ
dZdZdZdZed	„ ¦   «         Zd
„ Zd„ ZdS )ÚPbkdf2DigestHandlerz1base class for various pbkdf2_{digest} algorithms©ÚsaltÚ	salt_sizeÚroundsé   é   Né   ì   ÿÿ Úlinearc                 óê   — t          j        || j        | ¬¦  «        \  }}}t          |                     d¦  «        ¦  «        }|r"t          |                     d¦  «        ¦  «        } | |||¬¦  «        S )N)ÚhandlerÚascii©r   r   Úchecksum)ÚuhÚ	parse_mc3Úidentr   Úencode©ÚclsÚhashr   r   Úchks        úU/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/passlib/handlers/pbkdf2.pyÚfrom_stringzPbkdf2DigestHandler.from_string?   sr   € åœL¨¨s¬yÀ#ÐFÑFÔFÑˆ��cÝ˜4Ÿ;š; wÑ/Ô/Ñ0Ô0ˆØð 	3Ý˜cŸjšj¨Ñ1Ô1Ñ2Ô2ˆCØˆs˜& t°cÐ:Ñ:Ô:Ð:ó    c                 óà   — t          | j        ¦  «                             d¦  «        }t          | j        ¦  «                             d¦  «        }t	          j        | j        | j        ||¦  «        S ©Nr"   )r	   r   Údecoder$   r%   Ú
render_mc3r'   r   ©Úselfr   r,   s      r-   Ú	to_stringzPbkdf2DigestHandler.to_stringG   sV   € Ý˜4œ9Ñ%Ô%×,Ò,¨WÑ5Ô5ˆÝ˜$œ-Ñ(Ô(×/Ò/°Ñ8Ô8ˆÝŒ}˜TœZ¨¬°d¸CÑ@Ô@Ð@r/   c                 óP   — t          | j        || j        | j        | j        ¦  «        S )N)r   Ú_digestr   r   Úchecksum_size©r5   Úsecrets     r-   Ú_calc_checksumz"Pbkdf2DigestHandler._calc_checksumL   s!   € å˜4œ<¨°´¸D¼KÈÔI[Ñ\Ô\Ð\r/   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úsetting_kwdsr%   ÚHASH64_CHARSÚchecksum_charsÚdefault_salt_sizeÚmax_salt_sizeÚdefault_roundsÚ
min_roundsÚ
max_roundsÚrounds_costr8   Úclassmethodr.   r6   r<   © r/   r-   r   r      s“   € € € € € Ø;Ð;ð 3€LØ”_€Nð ÐØ€Mð €NØ€JØ€JØ€Kð €Gð ð;ð ;ñ „[ð;ðAð Að Að
]ð ]ð ]ð ]ð ]r/   r   ià.  c                 óø   — d| z   }|€t          d¦  «        | fz  }t          }t          ||ft          |||| |||dz  dz   dz  dt          |                      ¦   «         |j        |¬¦  «        z  ¬	¦  «        ¦  «        S )
z;create new Pbkdf2DigestHandler subclass for a specific hashÚpbkdf2_Nz$pbkdf2-%s$é   é   é   a$  This class implements a generic ``PBKDF2-HMAC-%(digest)s``-based password hash, and follows the :ref:`password-hash-api`.

    It supports a variable-length salt, and a variable number of rounds.

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

    :type salt: bytes
    :param salt:
        Optional salt bytes.
        If specified, the length must be between 0-1024 bytes.
        If not specified, a %(dsc)d byte salt will be autogenerated (this is recommended).

    :type salt_size: int
    :param salt_size:
        Optional number of bytes to use when autogenerating new salts.
        Defaults to %(dsc)d bytes, but can be any value between 0 and 1024.

    :type rounds: int
    :param rounds:
        Optional number of rounds to use.
        Defaults to %(dr)d, but must be within ``range(1,1<<32)``.

    :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 ``rounds``
        that are too small or too large, and ``salt`` strings that are too long.

        .. versionadded:: 1.6
    )ÚdigestÚdscÚdr)r>   Únamer'   r8   rF   r9   Úencoded_checksum_sizer@   )r   r   ÚtypeÚdictÚupperrD   )Ú	hash_nameÚdigest_sizer   r'   ÚmodulerT   Úbases          r-   Úcreate_pbkdf2_hashr]   P   s¡   € à�yÑ €DØ€}Ý�-Ñ Ô  I <Ñ/ˆÝ€DÝ��t�g�tØØØØØØ!Ø*¨1™}¨Q™°Ñ2ðõ> �i—o’oÑ'Ô'¨TÔ-CÈÐ
OÑ
OÔ
Oñ?Pð( ñ ( ô ( ñ (ô (ð (r/   Úsha1é   i¸ÿ z$pbkdf2$)r'   Úsha256é    iHq  Úsha512é@   i¨a  Úldap_pbkdf2_sha1z{PBKDF2}TÚldap_pbkdf2_sha256z{PBKDF2-SHA256}z$pbkdf2-sha256$Úldap_pbkdf2_sha512z{PBKDF2-SHA512}z$pbkdf2-sha512$s   -_c                   óx   — e Zd ZdZd ZdZ ed¦  «        ZdZdZ	dZ
ej        ZdZdZd	Zed
„ ¦   «         Zd„ Zd„ ZdS )r   aë  This class implements Cryptacular's PBKDF2-based crypt algorithm, and follows the :ref:`password-hash-api`.

    It supports a variable-length salt, and a variable number of rounds.

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

    :type salt: bytes
    :param salt:
        Optional salt bytes.
        If specified, it may be any length.
        If not specified, a one will be autogenerated (this is recommended).

    :type salt_size: int
    :param salt_size:
        Optional number of bytes to use when autogenerating new salts.
        Defaults to 16 bytes, but can be any value between 0 and 1024.

    :type rounds: int
    :param rounds:
        Optional number of rounds to use.
        Defaults to 60000, must be within ``range(1,1<<32)``.

    :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 ``rounds``
        that are too small or too large, and ``salt`` strings that are too long.

        .. versionadded:: 1.6
    r   ú$p5k2$r_   r   r   r   r   r   c                 ó  — t          j        || j        d| ¬¦  «        \  }}}t          |                     d¦  «        t
          ¦  «        }|r(t          |                     d¦  «        t
          ¦  «        } | |||¬¦  «        S )Nr   )Úrounds_baser!   r"   r#   )r%   r&   r'   r   r(   ÚCTA_ALTCHARSr)   s        r-   r.   zcta_pbkdf2_sha1.from_stringÖ   s{   € õ œL¨¨s¬yÀbÐRUÐVÑVÔVÑˆ��cÝ˜Ÿš WÑ-Ô-­|Ñ<Ô<ˆØð 	?Ý˜CŸJšJ wÑ/Ô/µÑ>Ô>ˆCØˆs˜& t°cÐ:Ñ:Ô:Ð:r/   c                 óü   — t          | j        t          ¦  «                             d¦  «        }t          | j        t          ¦  «                             d¦  «        }t          j        | j        | j        ||d¬¦  «        S )Nr"   r   ©rj   )	r   r   rk   r2   r$   r%   r3   r'   r   r4   s      r-   r6   zcta_pbkdf2_sha1.to_stringß   s_   € Ý˜œ¥LÑ1Ô1×8Ò8¸ÑAÔAˆÝ˜œ¥|Ñ4Ô4×;Ò;¸GÑDÔDˆÝŒ}˜TœZ¨¬°d¸CÈRÐPÑPÔPÐPr/   c                 ó<   — t          d|| j        | j        d¦  «        S )Nr^   r_   ©r   r   r   r:   s     r-   r<   zcta_pbkdf2_sha1._calc_checksumç   s   € å˜6 6¨4¬9°d´kÀ2ÑFÔFÐFr/   N)r=   r>   r?   r@   rT   rA   r   r'   r9   rD   rE   r   rF   rG   rH   rI   rJ   r.   r6   r<   rK   r/   r-   r   r   ’   s¤   € € € € € ðð ðJ €DØ2€LØˆAˆh‰KŒK€EØ€Mð ÐØ€Mð !Ô/€NØ€JØ€JØ€Kð ð;ð ;ñ „[ð;ðQð Qð QðGð Gð Gð Gð Gr/   r   c                   óž   — e Zd ZdZd ZdZ ed¦  «        Z ed¦  «        ZdZ	dZ
ej        Zej        ZdZdZd	Zed
„ ¦   «         Zd„ Zd„ Zd„ ZdS )r   aC  This class implements Dwayne Litzenberger's PBKDF2-based crypt algorithm, and follows the :ref:`password-hash-api`.

    It supports a variable-length salt, and a variable number of rounds.

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

    :type salt: str
    :param salt:
        Optional salt string.
        If specified, it may be any length, but must use the characters in the regexp range ``[./0-9A-Za-z]``.
        If not specified, a 16 character salt will be autogenerated (this is recommended).

    :type salt_size: int
    :param salt_size:
        Optional number of bytes to use when autogenerating new salts.
        Defaults to 16 bytes, but can be any value between 0 and 1024.

    :type rounds: int
    :param rounds:
        Optional number of rounds to use.
        Defaults to 60000, must be within ``range(1,1<<32)``.

    :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 ``rounds``
        that are too small or too large, and ``salt`` strings that are too long.

        .. versionadded:: 1.6
    r   rh   z1000000000000000000000000000000000000000000000000=r   r   r   r   r   c                 ób   — t          j        || j        dd| ¬¦  «        \  }}} | |||¬¦  «        S )Nr   é�  )rj   rF   r!   r#   )r%   r&   r'   r)   s        r-   r.   zdlitz_pbkdf2_sha1.from_string9  sF   € åœL¨¨s¬yÀbØ8;ÀSðJñ Jô JÑˆ��càˆs˜& t°cÐ:Ñ:Ô:Ð:r/   c                 óp   — | j         }|dk    rd }t          j        | j        || j        | j        d¬¦  «        S ©Nrr   r   rm   )r   r%   r3   r'   r   r$   ©r5   r   s     r-   r6   zdlitz_pbkdf2_sha1.to_string?  s9   € Ø”ˆØ�SŠ=ˆ=ØˆFÝŒ}˜TœZ¨°´¸D¼MÐWYÐZÑZÔZÐZr/   c                 óf   — | j         }|dk    rd }t          j        | j        || j        d d¬¦  «        S rt   )r   r%   r3   r'   r   ru   s     r-   Ú_get_configzdlitz_pbkdf2_sha1._get_configE  s6   € Ø”ˆØ�SŠ=ˆ=ØˆFÝŒ}˜TœZ¨°´¸DÈbÐQÑQÔQÐQr/   c                 óž   — |                       ¦   «         }t          d||| j        d¦  «        }t          |¦  «                             d¦  «        S )Nr^   é   r"   )rw   r   r   r	   r2   )r5   r;   r   Úresults       r-   r<   z dlitz_pbkdf2_sha1._calc_checksumN  sF   € à×ÒÑ!Ô!ˆÝ˜V V¨T°4´;ÀÑCÔCˆÝ˜6Ñ"Ô"×)Ò)¨'Ñ2Ô2Ð2r/   N)r=   r>   r?   r@   rT   rA   r   r'   Ú_stub_checksumrD   rE   r%   rB   Ú
salt_charsr   rF   rG   rH   rI   rJ   r.   r6   rw   r<   rK   r/   r-   r   r   ò   sÂ   € € € € € ðð ðJ €DØ2€LØˆAˆh‰KŒK€EØ�Q�~Ñ&Ô&€Nð ÐØ€MØ”€Jð
 !Ô/€NØ€JØ€JØ€Kð ð;ð ;ñ „[ð;ð
[ð [ð [ðRð Rð Rð3ð 3ð 3ð 3ð 3r/   r   c                   ó^   — e Zd ZdZd ZdZ ed¦  «        ZdZdxZ	Z
ed„ ¦   «         Zd„ Zd„ Zd	S )
Úatlassian_pbkdf2_sha1aB  This class implements the PBKDF2 hash used by Atlassian.

    It supports a fixed-length salt, and a fixed number of rounds.

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

    :type salt: bytes
    :param salt:
        Optional salt bytes.
        If specified, the length must be exactly 16 bytes.
        If not specified, a salt will be autogenerated (this is recommended).

    :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
    )r   z	{PKCS5S2}ra   r   c                 óJ  — t          |dd¦  «        }| j        }|                     |¦  «        st          j                             | ¦  «        ‚t          |t          |¦  «        d …                              d¦  «        ¦  «        }|d d…         |dd …         }} | ||¬¦  «        S )Nr"   r+   r   )r   r$   )	r   r'   Ú
startswithr%   ÚexcÚInvalidHashErrorr   Úlenr(   )r*   r+   r'   Údatar   r,   s         r-   r.   z!atlassian_pbkdf2_sha1.from_string{  sœ   € å˜$ ¨Ñ0Ô0ˆØ”	ˆØ�Š˜uÑ%Ô%ð 	/Ý”&×)Ò)¨#Ñ.Ô.Ð.Ý˜�c %™jœj˜k˜kÔ*×1Ò1°'Ñ:Ô:Ñ;Ô;ˆØ˜˜"˜”I˜t B C CœyˆcˆØˆs˜ sÐ+Ñ+Ô+Ð+r/   c                 ó’   — | j         | j        z   }| j        t          |¦  «                             d¦  «        z   }t          |¦  «        S r1   )r   r$   r'   r   r2   r   )r5   r„   r+   s      r-   r6   zatlassian_pbkdf2_sha1.to_string…  s>   € ØŒy˜4œ=Ñ(ˆØŒz�I d™OœO×2Ò2°7Ñ;Ô;Ñ;ˆÝ˜TÑ"Ô"Ð"r/   c                 ó2   — t          d|| j        dd¦  «        S )Nr^   i'  ra   )r   r   r:   s     r-   r<   z$atlassian_pbkdf2_sha1._calc_checksumŠ  s   € õ ˜6 6¨4¬9°e¸RÑ@Ô@Ð@r/   N)r=   r>   r?   r@   rT   rA   r   r'   r9   Úmin_salt_sizerE   rJ   r.   r6   r<   rK   r/   r-   r~   r~   [  s„   € € € € € ðð ð. #€DØ€LØˆAˆk‰NŒN€EØ€Mð %'Ð&€M�Màð,ð ,ñ „[ð,ð#ð #ð #ð
Að Að Að Að Ar/   r~   c                   óx   — e Zd ZdZd ZdZ ed¦  «        ZdZdZ	dZ
ej        ZdZdZdZed	„ ¦   «         Zd
„ Zd„ ZdS )r   aÿ  This class implements Grub's pbkdf2-hmac-sha512 hash, and follows the :ref:`password-hash-api`.

    It supports a variable-length salt, and a variable number of rounds.

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

    :type salt: bytes
    :param salt:
        Optional salt bytes.
        If specified, the length must be between 0-1024 bytes.
        If not specified, a 64 byte salt will be autogenerated (this is recommended).

    :type salt_size: int
    :param salt_size:
        Optional number of bytes to use when autogenerating new salts.
        Defaults to 64 bytes, but can be any value between 0 and 1024.

    :type rounds: int
    :param rounds:
        Optional number of rounds to use.
        Defaults to 19000, but must be within ``range(1,1<<32)``.

    :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 ``rounds``
        that are too small or too large, and ``salt`` strings that are too long.

        .. versionadded:: 1.6
    r   zgrub.pbkdf2.sha512.rc   r   r   r   r   c                 ó  — t          j        || j        t          d¦  «        | ¬¦  «        \  }}}t	          |                     d¦  «        ¦  «        }|r"t	          |                     d¦  «        ¦  «        } | |||¬¦  «        S )Nú.)Úsepr!   r"   r#   )r%   r&   r'   r   r   r(   r)   s        r-   r.   zgrub_pbkdf2_sha512.from_stringÆ  s�   € åœL¨¨s¬y½aÀ¹f¼fØ14ð6ñ 6ô 6Ñˆ��cå˜Ÿš WÑ-Ô-Ñ.Ô.ˆØð 	1Ý˜CŸJšJ wÑ/Ô/Ñ0Ô0ˆCØˆs˜& t°cÐ:Ñ:Ô:Ð:r/   c           	      óF  — t          | j        ¦  «                             d¦  «                             ¦   «         }t          | j        ¦  «                             d¦  «                             ¦   «         }t          j        | j        | j        ||t          d¦  «        ¬¦  «        S )Nr"   rŠ   )r‹   )
r   r   r2   rX   r$   r%   r3   r'   r   r   r4   s      r-   r6   zgrub_pbkdf2_sha512.to_stringÏ  sy   € Ý�t”yÑ!Ô!×(Ò(¨Ñ1Ô1×7Ò7Ñ9Ô9ˆÝ�d”mÑ$Ô$×+Ò+¨GÑ4Ô4×:Ò:Ñ<Ô<ˆÝŒ}˜TœZ¨¬°d¸CÅQÀsÁVÄVÐLÑLÔLÐLr/   c                 ó<   — t          d|| j        | j        d¦  «        S )Nrb   rc   ro   r:   s     r-   r<   z!grub_pbkdf2_sha512._calc_checksumÔ  s   € õ ˜8 V¨T¬Y¸¼ÀRÑHÔHÐHr/   N)r=   r>   r?   r@   rT   rA   r   r'   r9   rD   rE   r   rF   rG   rH   rI   rJ   r.   r6   r<   rK   r/   r-   r   r   “  s£   € € € € € ðð ð@  €DØ2€LàˆAÐ#Ñ$Ô$€EØ€Mð ÐØ€Mà"Ô1€NØ€JØ€JØ€Kàð;ð ;ñ „[ð;ðMð Mð Mð
Ið Ið Ið Ið Ir/   r   )/r@   Úbinasciir   r   Úbase64r   r   ÚloggingÚ	getLoggerr=   ÚlogÚpasslib.utilsr   Úpasslib.utils.binaryr   r	   Úpasslib.utils.compatr
   r   r   r   Úpasslib.crypto.digestr   Úpasslib.utils.handlersÚutilsÚhandlersr%   Ú__all__Ú	HasRoundsÚ
HasRawSaltÚHasRawChecksumÚGenericHandlerr   r]   r   r   r   ÚPrefixWrapperrd   re   rf   rk   r   ÚHasSaltr   r~   r   rK   r/   r-   ú<module>r¡      s  ðØ 2Ð 2ð
 (Ð 'Ð 'Ð 'Ð 'Ð 'Ð 'Ð 'Ø 'Ð 'Ð 'Ð 'Ð 'Ð 'Ð 'Ð 'Ø €€€Ð'�gÔ'¨Ñ1Ô1�ð %Ð $Ð $Ð $Ð $Ð $Ø 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ø IÐ IÐ IÐ IÐ IÐ IÐ IÐ IÐ IÐ IÐ IÐ IØ -Ð -Ð -Ð -Ð -Ð -Ø #Ð #Ð #Ð #Ð #Ð #Ð #Ð #Ð #ðð ð €ð1]ð 1]ð 1]ð 1]ð 1]˜"œ,¨¬°rÔ7HÈ"ÔJ[ñ 1]ô 1]ð 1]ðf 7<À4ÐPXð .ð .ð .ð .ðf !Ð  ¨¨V¸1¸1¸Z¹=¼=ÐIÑIÔI€Ø"Ð" 8¨R°Ñ7Ô7€Ø"Ð" 8¨R°Ñ7Ô7€à#�2Ô#Ð$6¸ÀZÐQ[ÐcgÐhÑhÔhÐ Ø%�RÔ%Ð&:¸MÐK\Ð^oÐw{Ð|Ñ|Ô|Ð Ø%�RÔ%Ð&:¸MÐK\Ð^oÐw{Ð|Ñ|Ô|Ð ð €ðWGð WGð WGð WGð WG�b”l B¤M°2Ô3DÀbÔFWñ WGô WGð WGð@`3ð `3ð `3ð `3ð `3˜œ b¤j°"Ô2Cñ `3ô `3ð `3ðR3Að 3Að 3Að 3Að 3A˜BœM¨2Ô+<¸bÔ>Oñ 3Aô 3Að 3AðpDIð DIð DIð DIð DI˜œ r¤}°bÔ6GÈÔIZñ DIô DIð DIð DIð DIr/   