+
    i2                     &   R t ^ RIHtHt ^ RIHtHtHtHt ^ RI	t	]	P                  ! ]4      t^ RIt^ RIHt ^ RIHtHt ^ RIHtHtHt ^ RIHt ^ RIHu Ht . ROt ! R R]P<                  4      t ! R R]P@                  ]PB                  ]PD                  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.passlib.handlers.digests - plain hash digests
)	b64encode	b64decode)md5sha1sha256sha512N)	plaintext)unix_crypt_schemes
to_unicode)uascii_to_strunicodeu)classpropertyldap_plaintextldap_md5	ldap_sha1ldap_salted_md5ldap_salted_sha1ldap_salted_sha256ldap_salted_sha512c                   ^   a  ] tR t^)t o RtRtRtRt]P                  t
]R 4       tR tRtV tR# )_Base64DigestHelperzhelper for ldap_md5 / ldap_sha1Nc                    V P                   # )z/tell StaticHandler to strip ident from checksum)identclss   &[/var/www/html/photoedit/myenv/lib/python3.14/site-packages/passlib/handlers/ldap_digests.py_hash_prefix _Base64DigestHelper._hash_prefix2   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)
isinstancer   encode
_hash_funcdigestr   decode)selfsecretchks   && r   _calc_checksum"_Base64DigestHelper._calc_checksum7   sI    fg&&]]7+Foof%,,.~$$W--r    )__name__
__module____qualname____firstlineno____doc__r   r%   _hash_regexuhPADDED_BASE64_CHARSchecksum_charsr   r   r+   __static_attributes____classdictcell____classdict__s   @r   r   r   )   s@     ) EJK++N . .r   r   c                   |   a  ] tR t^=t o RtRt]P                  tRt	Rt
Rt^;tt^t^t^t]R 4       tR tR tRtV tR# )_SaltedBase64DigestHelperz-helper for ldap_salted_md5 / ldap_salted_sha1Nc                   \        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
   r3   matchr4   excInvalidHashErrorr   groupr$   	TypeErrorMalformedHashErrorchecksum_size)r   r>   mdatacss   &&   r   from_string%_SaltedBase64DigestHelper.from_stringN   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      ,           p\        V4      # )r"   )r@   rA   r   r   r'   r   )r(   rJ   r>   s   &  r   	to_string#_SaltedBase64DigestHelper.to_string\   s<    }}tyy(zzIdO227;;T""r   c                    \        V\        4      '       d   VP                  R 4      pV P                  WP                  ,           4      P                  4       # )r!   )r#   r   r$   r%   rA   r&   )r(   r)   s   &&r   r+   (_SaltedBase64DigestHelper._calc_checksuma   s<    fg&&]]7+Fv		1299;;r   r-   )rA   	salt_size)r.   r/   r0   r1   r2   setting_kwdsr4   r5   r6   r   r%   r3   min_salt_sizemax_salt_sizedefault_salt_sizeclassmethodrL   rO   r+   r7   r8   r9   s   @r   r<   r<   =   sd     7(L++NEJK$%%MM
 MM7 7#
< <r   r<   c                   b    ] tR t^itRtR t]! R4      t]t	]
P                  ! ]! R4      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}==)$r-   N)r.   r/   r0   r1   r2   namer   r   r   r%   recompiler3   r7   r-   r   r   r   r   i   s0     DgJEJ**QGHIKr   c                   b    ] tR t^stRtR t]! R4      t]t	]
P                  ! ]! R4      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}=)$r-   N)r.   r/   r0   r1   r2   rZ   r   r   r   r%   r[   r\   r3   r7   r-   r   r   r   r   s   s0     DgJEJ**QFGHKr   c                   f    ] tR t^}tRtR t]! R4      t^t]	t
]P                  ! ]! R4      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})$r-   N)r.   r/   r0   r1   r2   rZ   r   r   rH   r   r%   r[   r\   r3   r7   r-   r   r   r   r   }   s6    @ DhKEMJ**QMNOKr   c                   f    ] tR t^tRtR t]! R4      t^t]	t
]P                  ! ]! R4      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})$r-   N)r.   r/   r0   r1   r2   rZ   r   r   rH   r   r%   r[   r\   r3   r7   r-   r   r   r   r      s6    !D DhKEMJ**QMNOKr   c                   j    ] tR t^tRtR t]! R4      t^ t^t	]
t]P                  ! ]! R4      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})$r-   N)r.   r/   r0   r1   r2   rZ   r   r   rH   rW   r   r%   r[   r\   r3   r7   r-   r   r   r   r      ;    <  DkNEMJ**QPQRKr   c                   j    ] tR t^tRtR t]! R4      t^@t^t	]
t]P                  ! ]! R4      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})$r-   N)r.   r/   r0   r1   r2   rZ   r   r   rH   rW   r   r%   r[   r\   r3   r7   r-   r   r   r   r      ra   r   c                      a  ] tR tRt o RtR t]P                  ! ]! R4      4      t	]
P                  ! RRR7      ]R 4       4       t]R 4       tR	tV 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:`!unicode` 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 # )!r-   r   s   &r   	genconfigldap_plaintext.genconfig:  s    
 r   c                    \         P                  ! V4      p\        V4      ;'       d    V P                  P	                  V4      R J # )N)r4   to_unicode_for_identifybool	_2307_patrB   )r   r>   s   &&r   identifyldap_plaintext.identifyA  s:     ))$/Dz??cmm11$74??r   r-   N)r.   r/   r0   r1   r2   rZ   r[   r\   r   rm   r4   deprecated_methodrX   rh   rn   r7   r8   r9   s   @r   r   r      sa     , D

1^,-IUE:  ;
 @ @r   ldap_c                      \        4       p \         F0  pR V,           p\        P                  ! W!\	        R4      RR7      W&   K2  	  ? R# )rq   z{CRYPT}T)prefixlazyN)globalsr	   r4   PrefixWrapperr   )gwnamerZ   s      r   _init_ldap_crypt_handlersry   N  s=     		A#""4q|$O $ 	
r   )r   r   r   r   r   r   r   ldap_des_cryptldap_bsdi_cryptldap_md5_cryptldap_sha1_cryptldap_bcryptldap_sha256_cryptldap_sha512_crypt)-r2   base64r   r   hashlibr   r   r   r   logging	getLoggerr.   logr[   passlib.handlers.miscr   passlib.utilsr	   r
   passlib.utils.compatr   r   r   passlib.utils.decorr   passlib.utils.handlersutilshandlersr4   __all__StaticHandlerr   
HasRawSaltHasRawChecksumGenericHandlerr<   r   r   r   r   r   r   r   ldap_crypt_schemesry   )rZ   s   0r   <module>r      s   ( - - g''1 	 , 8 : : - # #,."** .('<r/@/@"BSBS '<XJ" JI# I%P/ %PN(P0 (PX%S2 %SP%S2 %SP%@Y %@X 3EF2D$w~~2DF 
   Gs   -D