+
    ¢THi£&  ã                   óš  € ^ RI Ht ^ RIHu Ht ^ RIHt ^ RIH	t	H
t
 ]! R4      P                  t. ROt ! R R]P                  ]P                  ]P                   4      t ! R R]P                   4      t]P&                  ! R]RRRR7      t ! R R	]P*                  ]P                   4      t ! R R
]P*                  ]P                   4      tR# )é    )ÚhexlifyN)Úlookup_hash)Úright_pad_stringÚ
to_unicodeÚmd4ÚlmhashÚnthashÚ
bsd_nthashÚmsdccÚmsdcc2c                   ó~   a € ] tR t^t o RtR tR	t]P                  t	^ t
^tRt]R 4       tR tRt]R
R l4       tRtV tR# )r   a®  This class implements the Lan Manager Password hash, and follows the :ref:`password-hash-api`.

It has no salt and a single fixed round.

The :meth:`~passlib.ifc.PasswordHash.using` method accepts a single
optional keyword:

:param bool truncate_error:
    By default, this will silently truncate passwords larger than 14 bytes.
    Setting ``truncate_error=True`` will cause :meth:`~passlib.ifc.PasswordHash.hash`
    to raise a :exc:`~passlib.exc.PasswordTruncateError` instead.

    .. versionadded:: 1.7

The :meth:`~passlib.ifc.PasswordHash.hash` and :meth:`~passlib.ifc.PasswordHash.verify` methods accept a single
optional keyword:

:type encoding: str
:param encoding:

    This specifies what character encoding LMHASH should use when
    calculating digest. It defaults to ``cp437``, the most
    common encoding encountered.

Note that while this class outputs digests in lower-case hexadecimal,
it will accept upper-case as well.
Úcp437c                ó"   € VP                  4       # ©N©Úlower©ÚclsÚhashs   &&Ú:/usr/lib/python3/dist-packages/passlib/handlers/windows.pyÚ
_norm_hashÚlmhash._norm_hashE   ó   € à�z‰z‹|Ðó    c                ó®   € V P                   '       d   V P                  V4       \        V P                  WP                  4      4      P                  R 4      # ©Úascii)Úuse_defaultsÚ_check_truncate_policyr   ÚrawÚencodingÚdecode©ÚselfÚsecrets   &&r   Ú_calc_checksumÚlmhash._calc_checksumI   s?   € à××ÐØ×'Ñ'¨Ô/ä�t—x‘x ¯©Ó6Ó7×>Ñ>¸wÓGÐGr   s   KGS!@#$%Nc                ó€  € V'       g   V P                   p^ RIHp V P                  p\	        V\
        4      '       d!   VP                  4       P                  V4      pM2\	        V\        4      '       d   VP                  4       pM\        R4      h\        V^4      pV! VR,          V4      V! VR,          V4      ,           # )a@  encode password using LANMAN hash algorithm.

:type secret: str or utf-8 encoded bytes
:arg secret: secret to hash
:type encoding: str
:arg encoding:
    optional encoding to use for unicode inputs.
    this defaults to ``cp437``, which is the
    common case for most situations.

:returns: returns string of raw bytes
)Údes_encrypt_blockzsecret must be str or bytes:r   é   N:r*   é   N)Údefault_encodingÚpasslib.crypto.desr)   Ú_magicÚ
isinstanceÚstrÚupperÚencodeÚbytesÚ	TypeErrorr   )r   r%   r!   r)   ÚMAGICs   &&&  r   r    Ú
lmhash.rawS   s    € ÷ Ø×+Ñ+ˆHõ 	9à—
‘
ˆÜ�fœc×"Ò"ð —\‘\“^×*Ñ*¨8Ó4‰FÜ˜¤×&Ò&ð
 —\‘\“^‰FäÐ9Ó:Ð:Ü! &¨"Ó-ˆÙ  ¨¥¨eÓ4Ñ7HØ�4�L˜%ó8
õ 
ð 	
r   © )Útruncate_errorr   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__ÚnameÚsetting_kwdsÚuhÚ	HEX_CHARSÚchecksum_charsÚchecksum_sizeÚtruncate_sizer,   Úclassmethodr   r&   r.   r    Ú__static_attributes__Ú__classdictcell__©Ú__classdict__s   @r   r   r      sf   ø‡ € ñð> €DØ&€Lð
 —\‘\€NØ€Mð
 €Mð
 Ðàñó ðòHð €Fàó%
ó ö%
r   c                   ój   a € ] tR t^|t o RtR t]P                  t^ t	]
R 4       tR t]
R 4       tRtV tR# )r	   ap  This class implements the NT Password hash, and follows the :ref:`password-hash-api`.

It has no salt and a single fixed round.

The :meth:`~passlib.ifc.PasswordHash.hash` and :meth:`~passlib.ifc.PasswordHash.genconfig` methods accept no optional keywords.

Note that while this class outputs lower-case hexadecimal digests,
it will accept upper-case digests as well.
c                ó"   € VP                  4       # r   r   r   s   &&r   r   Únthash._norm_hash‹   r   r   c                óT   € \        V P                  V4      4      P                  R 4      # r   )r   r    r"   r#   s   &&r   r&   Únthash._calc_checksum�   s!   € Ü�t—x‘x Ó'Ó(×/Ñ/°Ó8Ð8r   c                ón   € \        VRRR7      p\        VP                  R4      4      P                  4       # )z�encode password using MD4-based NTHASH algorithm

:arg secret: secret as unicode or utf-8 encoded bytes

:returns: returns string of raw bytes
úutf-8r%   ©Úparamú	utf-16-le)r   r   r2   Údigest)r   r%   s   &&r   r    Ú
nthash.raw’   s/   € ô ˜F G°8Ô<ˆä�6—=‘= Ó-Ó.×5Ñ5Ó7Ð7r   r7   N©r9   r:   r;   r<   r=   r>   r@   rA   rB   rC   rE   r   r&   r    rF   rG   rH   s   @r   r	   r	   |   sJ   ø‡ € ñð €DØ—\‘\€NØ€Màñó ðò9ð ñ	8ó ö	8r   z$3$$aZ  The class support FreeBSD's representation of NTHASH
    (which is compatible with the :ref:`modular-crypt-format`),
    and follows the :ref:`password-hash-api`.

    It has no salt and a single fixed round.

    The :meth:`~passlib.ifc.PasswordHash.hash` and :meth:`~passlib.ifc.PasswordHash.genconfig` methods accept no optional keywords.
    )ÚprefixÚidentÚdocc                   ój   a € ] tR t^Ít o RtR t]P                  t^ t	]
R 4       tR t]
R 4       tRtV tR# )r   a  This class implements Microsoft's Domain Cached Credentials password hash,
and follows the :ref:`password-hash-api`.

It has a fixed number of rounds, and uses the associated
username as the salt.

The :meth:`~passlib.ifc.PasswordHash.hash`, :meth:`~passlib.ifc.PasswordHash.genhash`, and :meth:`~passlib.ifc.PasswordHash.verify` methods
have the following optional keywords:

:type user: str
:param user:
    String containing name of user account this password is associated with.
    This is required to properly calculate the hash.

    This keyword is case-insensitive, and should contain just the username
    (e.g. ``Administrator``, not ``SOMEDOMAIN\Administrator``).

Note that while this class outputs lower-case hexadecimal digests,
it will accept upper-case digests as well.
c                ó"   € VP                  4       # r   r   r   s   &&r   r   Úmsdcc._norm_hashç   r   r   c                óh   € \        V P                  WP                  4      4      P                  R 4      # r   ©r   r    Úuserr"   r#   s   &&r   r&   Úmsdcc._calc_checksumë   ó%   € Ü�t—x‘x ¯	©	Ó2Ó3×:Ñ:¸7ÓCÐCr   c                ó   € \        VRRR7      P                  R4      p\        VRRR7      P                  4       P                  R4      p\        \        V4      P	                  4       V,           4      P	                  4       # )z§encode password using mscash v1 algorithm

:arg secret: secret as str or utf-8 encoded bytes
:arg user: username to use as salt

:returns: returns string of raw bytes
rP   r%   rQ   rS   r_   )r   r2   r   r   rT   )r   r%   r_   s   &&&r   r    Ú	msdcc.rawî   se   € ô ˜F G°8Ô<×CÑCÀKÓPˆÜ˜$ ¨vÔ6×<Ñ<Ó>×EÑEÀkÓRˆÜ”3�v“;×%Ñ%Ó'¨$Õ.Ó/×6Ñ6Ó8Ð8r   r7   NrV   rH   s   @r   r   r   Í   sK   ø‡ € ñð* €DØ—\‘\€NØ€Màñó ðòDð ñ
9ó ö
9r   c                   ój   a € ] tR t^üt o RtR t]P                  t^ t	]
R 4       tR t]
R 4       tRtV tR# )r   a­  This class implements version 2 of Microsoft's Domain Cached Credentials
password hash, and follows the :ref:`password-hash-api`.

It has a fixed number of rounds, and uses the associated
username as the salt.

The :meth:`~passlib.ifc.PasswordHash.hash`, :meth:`~passlib.ifc.PasswordHash.genhash`, and :meth:`~passlib.ifc.PasswordHash.verify` methods
have the following extra keyword:

:type user: str
:param user:
    String containing name of user account this password is associated with.
    This is required to properly calculate the hash.

    This keyword is case-insensitive, and should contain just the username
    (e.g. ``Administrator``, not ``SOMEDOMAIN\Administrator``).
c                ó"   € VP                  4       # r   r   r   s   &&r   r   Úmsdcc2._norm_hash  r   r   c                óh   € \        V P                  WP                  4      4      P                  R 4      # r   r^   r#   s   &&r   r&   Úmsdcc2._calc_checksum  ra   r   c                ó"  € ^ RI Hp \        VRRR7      P                  R4      p\        VRRR7      P	                  4       P                  R4      p\        \        V4      P                  4       V,           4      P                  4       pV! RWBR^4      # )	zºencode password using msdcc v2 algorithm

:type secret: str or utf-8 bytes
:arg secret: secret

:type user: str
:arg user: username to use as salt

:returns: returns string of raw bytes
)Úpbkdf2_hmacrP   r%   rQ   rS   r_   Úsha1i (  )Úpasslib.crypto.digestrj   r   r2   r   r   rT   )r   r%   r_   rj   Útmps   &&&  r   r    Ú
msdcc2.raw  sx   € õ 	6ä˜F G°8Ô<×CÑCÀKÓPˆÜ˜$ ¨vÔ6×<Ñ<Ó>×EÑEÀkÓRˆÜ”#�f“+×$Ñ$Ó&¨Õ-Ó.×5Ñ5Ó7ˆÙ˜6 3¨e°RÓ8Ð8r   r7   NrV   rH   s   @r   r   r   ü   sK   ø‡ € ñð$ €DØ—\‘\€NØ€Màñó ðòDð ñ9ó ö9r   )r   r	   r
   r   r   )Úbinasciir   Úpasslib.utils.handlersÚutilsÚhandlersr@   rl   r   Úpasslib.utilsr   r   Úconstr   Ú__all__ÚTruncateMixinÚHasEncodingContextÚStaticHandlerr   r	   ÚPrefixWrapperr
   ÚHasUserContextr   r   r7   r   r   Ú<module>r{      s¼   ðÝ ç #Ð #Ý -ß 6á�%Ó×Ñ€ò€ôg
ˆR×Ñ˜r×4Ñ4°b×6FÑ6Fô g
ôT 8ˆR×Ñô  8ðF ×ÒØØ
ØØ
ð	ô€
ô\,9ˆB×Ñ˜r×/Ñ/ô ,9ô^/9ˆR×Ñ × 0Ñ 0ö /9r   