+
    ¢THi�/  ã                  ó  € R t ^ RIHt ^ RIt^ RIHtHt ^ RIHtH	t	H
t
Ht ^ RIHt ^ RIHu Ht ^ RIHt ^ RIHtHt ^ RIHt ]'       d   ^ R	IHt . ROt ! R R]P8                  4      t ! R R]P<                  ]P>                  ]P@                  4      t! ! R R]4      t" ! R R]4      t# ! R R]!4      t$ ! R R]!4      t% ! R R]!4      t& ! R R]!4      t' ! R R
]4      t(] U u. uF  p RV ,           NK  	  up t)R t*]*! 4        R# u up i )zplain hash digests)ÚannotationsN)Ú	b64decodeÚ	b64encode)Úmd5Úsha1Úsha256Úsha512)ÚTYPE_CHECKING)Ú	plaintext)Ú
to_unicodeÚunix_crypt_schemes)Úclassproperty)ÚSHAFuncÚldap_plaintextÚldap_md5Ú	ldap_sha1Úldap_salted_md5Úldap_salted_sha1Úldap_salted_sha256Úldap_salted_sha512c                  ót   € ] tR t^t$ RtRtR]R&   RtR]R&   RtR]R&   ]	P                  t]R	 4       tR
 tRtR# )Ú_Base64DigestHelperzhelper for ldap_md5 / ldap_sha1Nú
str | NoneÚidentúSHAFunc | NoneÚ
_hash_funcúre.Pattern[str] | NoneÚ_hash_regexc                ó   € V P                   # )z/tell StaticHandler to strip ident from checksum)r   ©Úclss   &Ú?/usr/lib/python3/dist-packages/passlib/handlers/ldap_digests.pyÚ_hash_prefixÚ _Base64DigestHelper._hash_prefix'   s   € ð �y‰yÐó    c                	óÂ   € \        V\        4      '       d   VP                  R 4      pV P                  V4      P	                  4       p\        V4      P                  R4      # )úutf-8Úascii)Ú
isinstanceÚstrÚencoder   Údigestr   Údecode)ÚselfÚsecretÚchks   && r!   Ú_calc_checksumÚ"_Base64DigestHelper._calc_checksum,   sI   € Ü�fœc×"Ò"Ø—]‘] 7Ó+ˆFØ�o‰o˜fÓ%×,Ñ,Ó.ˆÜ˜‹~×$Ñ$ WÓ-Ð-r$   © )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   Ú__annotations__r   r   ÚuhÚPADDED_BASE64_CHARSÚchecksum_charsr   r"   r0   Ú__static_attributes__r2   r$   r!   r   r      sH   ‡ Ù)ð €Eˆ:ÓØ!%€J�Ó%Ø*.€KÐ'Ó.Ø×+Ñ+€Nàñó ðö.r$   r   c                  ó’   € ] tR t^3t$ RtRt]P                  tRt	R]
R&   RtR]
R&   RtR]
R&   ^;tt^t^t^t]R	 4       tR
 tR tRtR# )Ú_SaltedBase64DigestHelperz-helper for ldap_salted_md5 / ldap_salted_sha1Nr   r   r   r   r   r   c                	óš  € \        VR R4      pV P                  P                  V4      pV'       g    \        P                  P                  V 4      h \        VP                  R4      P                  R 4      4      pT P                  pT'       g   Q hT ! TRT Y4R R7      #   \         d!    \        P                  P                  T 4      hi ; i)r'   ÚhashÚtmpN)ÚchecksumÚsalt)r   r   Úmatchr9   ÚexcÚInvalidHashErrorr   Úgroupr*   Ú	TypeErrorÚMalformedHashErrorÚchecksum_size)r    r@   ÚmÚdataÚcss   &&   r!   Úfrom_stringÚ%_SaltedBase64DigestHelper.from_stringE   s¯   € ä˜$ ¨Ó0ˆØ�O‰O×!Ñ! $Ó'ˆßÜ—&‘&×)Ñ)¨#Ó.Ð.ð	1Ü˜QŸW™W U›^×2Ñ2°7Ó;Ó<ˆDð ×Ñˆßˆ	ˆrÙ˜D  "˜I¨D°¨IÔ6Ð6øô	 ô 	1Ü—&‘&×+Ñ+¨CÓ0Ð0ð	1ús   Á)B Â+C
c                	ó’   € V P                   V P                  ,           pV P                  \        V4      P	                  R 4      ,           # )r'   )rB   rC   r   r   r,   )r-   rL   s   & r!   Ú	to_stringÚ#_SaltedBase64DigestHelper.to_stringS   s2   € Ø�}‰}˜tŸy™yÕ(ˆØ�z‰zœI d›O×2Ñ2°7Ó;Õ;Ð;r$   c                	ó®   € \        V\        4      '       d   VP                  R 4      pV P                  WP                  ,           4      P                  4       # )r&   )r(   r)   r*   r   rC   r+   )r-   r.   s   &&r!   r0   Ú(_SaltedBase64DigestHelper._calc_checksumW   s<   € Ü�fœc×"Ò"Ø—]‘] 7Ó+ˆFØ�‰˜v¯	©	Õ1Ó2×9Ñ9Ó;Ð;r$   r2   )rC   Ú	salt_size)r3   r4   r5   r6   r7   Úsetting_kwdsr9   r:   r;   r   r8   r   r   Úmin_salt_sizeÚmax_salt_sizeÚdefault_salt_sizeÚclassmethodrN   rQ   r0   r<   r2   r$   r!   r>   r>   3   sl   ‡ Ù7à(€LØ×+Ñ+€Nà€Eˆ:ÓØ!%€J�Ó%Ø*.€KÐ'Ó.Ø$%Ð%€M�Mð
 €MØÐØ€Màñ7ó ð7ò<ö<r$   r>   c                  óJ   € ] tR t^]tRtR tRt]t]	P                  ! R4      tRtR# )r   zäThis class stores passwords using LDAP's plain MD5 format, and follows the :ref:`password-hash-api`.

The :meth:`~passlib.ifc.PasswordHash.hash` and :meth:`~passlib.ifc.PasswordHash.genconfig` methods have no optional keywords.
z{MD5}z%^\{MD5\}(?P<chk>[+/a-zA-Z0-9]{22}==)$r2   N)r3   r4   r5   r6   r7   Únamer   r   r   ÚreÚcompiler   r<   r2   r$   r!   r   r   ]   s'   † ñð
 €DØ€EØ€JØ—*’*ÐEÓF„Kr$   c                  óJ   € ] tR t^itRtR tRt]t]	P                  ! R4      tRtR# )r   zåThis class stores passwords using LDAP's plain SHA1 format, and follows the :ref:`password-hash-api`.

The :meth:`~passlib.ifc.PasswordHash.hash` and :meth:`~passlib.ifc.PasswordHash.genconfig` methods have no optional keywords.
z{SHA}z$^\{SHA\}(?P<chk>[+/a-zA-Z0-9]{27}=)$r2   N)r3   r4   r5   r6   r7   r\   r   r   r   r]   r^   r   r<   r2   r$   r!   r   r   i   s'   † ñð
 €DØ€EØ€JØ—*’*ÐDÓE„Kr$   c                  óN   € ] tR t^utRtR tRt^t]t	]
P                  ! R4      tRtR# )r   ao  This class stores passwords using LDAP's salted MD5 format, and follows the :ref:`password-hash-api`.

It supports a 4-16 byte salt.

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

:type salt: bytes
:param salt:
    Optional salt string.
    If not specified, one will be autogenerated (this is recommended).
    If specified, it may be any 4-16 byte string.

:type salt_size: int
:param salt_size:
    Optional number of bytes to use when autogenerating new salts.
    Defaults to 4 bytes for compatibility with the LDAP spec,
    but some systems use larger salts, and Passlib supports
    any value between 4-16.

: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

.. versionchanged:: 1.6
    This format now supports variable length salts, instead of a fix 4 bytes.
z{SMD5}z+^\{SMD5\}(?P<tmp>[+/a-zA-Z0-9]{27,}={0,2})$r2   N)r3   r4   r5   r6   r7   r\   r   rJ   r   r   r]   r^   r   r<   r2   r$   r!   r   r   u   s-   † ñðB €DØ€EØ€MØ€JØ—*’*ÐKÓL„Kr$   c                  óN   € ] tR t^žtRtR tRt^t]t	]
P                  ! R4      tRtR# )r   as  
This class stores passwords using LDAP's "Salted SHA1" format,
and follows the :ref:`password-hash-api`.

It supports a 4-16 byte salt.

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

:type salt: bytes
:param salt:
    Optional salt string.
    If not specified, one will be autogenerated (this is recommended).
    If specified, it may be any 4-16 byte string.

:type salt_size: int
:param salt_size:
    Optional number of bytes to use when autogenerating new salts.
    Defaults to 4 bytes for compatibility with the LDAP spec,
    but some systems use larger salts, and Passlib supports
    any value between 4-16.

: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

.. versionchanged:: 1.6
    This format now supports variable length salts, instead of a fix 4 bytes.
z{SSHA}z+^\{SSHA\}(?P<tmp>[+/a-zA-Z0-9]{32,}={0,2})$r2   N)r3   r4   r5   r6   r7   r\   r   rJ   r   r   r]   r^   r   r<   r2   r$   r!   r   r   ž   s-   † ñ!ðF €DØ€EØ€MØ€Jà—*’*ÐKÓL„Kr$   c                  óR   € ] tR t^ÊtRtR tRt^ t^t]	t
]P                  ! R4      tRtR# )r   aç  
This class stores passwords using LDAP's "Salted SHA2-256" format,
and follows the :ref:`password-hash-api`.

It supports a 4-16 byte salt.

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

:type salt: bytes
:param salt:
    Optional salt string.
    If not specified, one will be autogenerated (this is recommended).
    If specified, it may be any 4-16 byte string.

:type salt_size: int
:param salt_size:
    Optional number of bytes to use when autogenerating new salts.
    Defaults to 8 bytes for compatibility with the LDAP spec,
    but Passlib supports any value between 4-16.

: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.7.3
z	{SSHA256}z.^\{SSHA256\}(?P<tmp>[+/a-zA-Z0-9]{48,}={0,2})$r2   N)r3   r4   r5   r6   r7   r\   r   rJ   rY   r   r   r]   r^   r   r<   r2   r$   r!   r   r   Ê   ó2   † ñð>  €DØ€EØ€MØÐØ€Jà—*’*ÐNÓO„Kr$   c                  óR   € ] tR t^ótRtR tRt^@t^t]	t
]P                  ! R4      tRtR# )r   aç  
This class stores passwords using LDAP's "Salted SHA2-512" format,
and follows the :ref:`password-hash-api`.

It supports a 4-16 byte salt.

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

:type salt: bytes
:param salt:
    Optional salt string.
    If not specified, one will be autogenerated (this is recommended).
    If specified, it may be any 4-16 byte string.

:type salt_size: int
:param salt_size:
    Optional number of bytes to use when autogenerating new salts.
    Defaults to 8 bytes for compatibility with the LDAP spec,
    but Passlib supports any value between 4-16.

: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.7.3
z	{SSHA512}z.^\{SSHA512\}(?P<tmp>[+/a-zA-Z0-9]{91,}={0,2})$r2   N)r3   r4   r5   r6   r7   r\   r   rJ   rY   r   r   r]   r^   r   r<   r2   r$   r!   r   r   ó   rc   r$   c                  ó�   € ] tR tRtRtR t]P                  ! R4      t]	P                  ! RRR7      ]R 4       4       t]R 4       tR	tR
# )r   i  a!  This class stores passwords in plaintext, and follows the :ref:`password-hash-api`.

This class acts much like the generic :class:`!passlib.hash.plaintext` handler,
except that it will identify a hash only if it does NOT begin with the ``{XXX}`` identifier prefix
used by RFC2307 passwords.

The :meth:`~passlib.ifc.PasswordHash.hash`, :meth:`~passlib.ifc.PasswordHash.genhash`, and :meth:`~passlib.ifc.PasswordHash.verify` methods all require the
following additional contextual keyword:

:type encoding: str
:param encoding:
    This controls the character encoding to use (defaults to ``utf-8``).

    This encoding will be used to encode :class:`!str` passwords
    under Python 2, and decode :class:`!bytes` hashes under Python 3.

.. versionchanged:: 1.6
    The ``encoding`` keyword was added.
z^\{\w+\}.*$z1.7z2.0)Ú
deprecatedÚremovedc                	ó   € R # )Ú!r2   r   s   &r!   Ú	genconfigÚldap_plaintext.genconfig7  s   € ñ
 r$   c                	óŽ   € \         P                  ! V4      p\        V4      ;'       d    V P                  P	                  V4      R J # )N)r9   Úto_unicode_for_identifyÚboolÚ	_2307_patrD   )r    r@   s   &&r!   ÚidentifyÚldap_plaintext.identify>  s:   € ô ×)Ò)¨$Ó/ˆÜ�D‹z×?Ð?˜cŸm™m×1Ñ1°$Ó7¸4Ð?Ð?r$   r2   N)r3   r4   r5   r6   r7   r\   r]   r^   ro   r9   Údeprecated_methodrZ   rj   rp   r<   r2   r$   r!   r   r     sY   † ñð. €DØ—
’
˜>Ó*€Ià×Ò U°EÔ:Øñó ó ;ðð
 ñ@ó ô@r$   Úldap_c                 ó~   € \        4       p \         F'  pR V,           p\        P                  ! W!RRR7      W&   K)  	  ? R# )rs   z{CRYPT}T)ÚprefixÚlazyN)Úglobalsr   r9   ÚPrefixWrapper)ÚgÚwnamer\   s      r!   Ú_init_ldap_crypt_handlersr{   M  s9   € ô 	‹	€Aß#ˆØ˜�ˆÜ×"Ò" 4°yÀtÔLˆ‹ñ $ò 	
r$   )r   r   r   r   r   r   r   )+r7   Ú
__future__r   r]   Úbase64r   r   Úhashlibr   r   r   r   Útypingr	   Úpasslib.utils.handlersÚutilsÚhandlersr9   Úpasslib.handlers.miscr
   Úpasslib.utilsr   r   Úpasslib.utils.decorr   Úpasslib._protocolsr   Ú__all__ÚStaticHandlerr   Ú
HasRawSaltÚHasRawChecksumÚGenericHandlerr>   r   r   r   r   r   r   r   Úldap_crypt_schemesr{   )r\   s   0r!   Ú<module>r�      s	  ðÙ å "ã 	ß 'ß -Ó -Ý  ç #Ð #Ý +ß 8Ý -çÝ*ò€ô.˜"×*Ñ*ô .ô,'< §¡¨r×/@Ñ/@À"×BSÑBSô '<ôT	GÐ"ô 	Gô	FÐ#ô 	Fô&MÐ/ô &MôR)MÐ0ô )MôX&PÐ2ô &PôR&PÐ2ô &PôR&@�Yô &@ñ\ 2DÓDÑ1C¨�g —n�nÑ1CÑDÐ ò
ñ Ö ùò Es   Ã'D