+
    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     yy    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    fc""]]7+Foof%,,.~$$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OO!!$'&&))#..	1QWWU^227;<D 	rD"IDI66	  	1&&++C00	1s   )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    }}tyy(zzIdO227;;;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<    fc""]]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'.$%%MM
 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   zThis 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FKr$   c                  J    ] tR t^itRtR tRt]t]	P                  ! R4      tRtR# )r   zThis 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EKr$   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LKr$   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LKr$   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OKr$   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:     ))$/Dz??cmm11$74??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UE:  ;
 @ @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#""4yt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/@/@"BSBS '<T	G" 	G	F# 	F&M/ &MR)M0 )MX&P2 &PR&P2 &PR&@Y &@\ 2DD1Cgnn1CD 
   Es   'D