+
    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       zz|    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?    ''/txx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

fc"" \\^**84F&&
 \\^F9::!&"- e47H4L%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!    txx'(//88r   c                n    \        VRRR7      p\        VP                  R4      4      P                  4       # )zencode 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/     FG8<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   %    txx		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       # )zencode 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     FG8<CCKP$v6<<>EEkR3v;%%'$./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      # )	zencode 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FG8<CCKP$v6<<>EEkR#f+$$&-.55763eR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4b6F6F g
T 8R  8F 

	
\,9Br// ,9^/9R 0 0 /9r   