+
    ¢THiŒ  ã                   óž   a € R t0 t R t^ RIHt ^ RIHt ^ RIHtHtH	t	 ^ RIH
t ^ RIHt . ROt]! R]4       / t] ^ k RtR tRR	 lt
RR
 ltR# )z¡passlib.pbkdf2 - PBKDF2 support

this module is getting increasingly poorly named.
maybe rename to "kdf" since it's getting more key derivation functions added.
)ÚMapping)Úwarn)Úcompile_hmacÚlookup_hashÚpbkdf2_hmac)Úpbkdf1)ÚExpectedTypeErrorzŠthe module 'passlib.utils.pbkdf2' is deprecated as of Passlib 1.7, and will be removed in Passlib 2.0, please use 'passlib.crypto' insteadc                ó¦  a€ V \         9   d   \         V ,          # \        V \        4      '       de   V P                  \        4      '       g   \        RV : 24      h\        V R,          4      P                  oV3R lpWP                  P                  3pM4\        V 4      '       d   \        V ! RR4      4      pW3pM\        V RR4      hV\         V &   V# )a“  Lookup pseudo-random family (PRF) by name.

:arg name:
    This must be the name of a recognized prf.
    Currently this only recognizes names with the format
    :samp:`hmac-{digest}`, where :samp:`{digest}`
    is the name of a hash function such as
    ``md5``, ``sha256``, etc.

    todo: restore text about callables.

:raises ValueError: if the name is not known
:raises TypeError: if the name is not a callable or string

:returns:
    a tuple of :samp:`({prf_func}, {digest_size})`, where:

    * :samp:`{prf_func}` is a function implementing
      the specified PRF, and has the signature
      ``prf_func(secret, message) -> digest``.

    * :samp:`{digest_size}` is an integer indicating
      the number of bytes the function returns.

Usage example::

    >>> from passlib.utils.pbkdf2 import get_prf
    >>> hmac_sha256, dsize = get_prf("hmac-sha256")
    >>> hmac_sha256
    <function hmac_sha256 at 0x1e37c80>
    >>> dsize
    32
    >>> digest = hmac_sha256('password', 'message')

.. deprecated:: 1.7

    This function is deprecated, and will be removed in Passlib 2.0.
    This only related replacement is :func:`passlib.crypto.digest.compile_hmac`.
zunknown prf algorithm: ºé   NNc                 ó(   <€ \        SV 4      ! V4      # )N)r   )ÚkeyÚmsgÚdigests   &&€Ú6/usr/lib/python3/dist-packages/passlib/utils/pbkdf2.pyÚhmacÚget_prf.<locals>.hmacZ   s   ø€ Ü ¨Ô,¨SÓ1Ð1ó    ó   xó   yzstr or callablezprf name)Ú
_prf_cacheÚ
isinstanceÚstrÚ
startswithÚ_HMAC_PREFIXESÚ
ValueErrorr   ÚnameÚdigest_infoÚdigest_sizeÚcallableÚlenr   )r   r   Úrecordr   r   s   &   @r   Úget_prfr"   +   s¸   ø€ ðP ŒzÔÜ˜$ÕÐÜ�$œ×ÒØ�‰œ~×.Ò.ÜÐ6°t±hÐ?Ó@Ð@Ü˜T "�XÓ&×+Ñ+ˆõ	2ð ×(Ñ(×4Ñ4Ð5‰Ü	�$�Šä™$˜t TÓ*Ó+ˆØÐ$‰ä Ð&7¸ÓDÐDØ„JˆtÑØ€Mr   Nc                ó   € \        W@WV4      # )a  pkcs#5 password-based key derivation v1.5

:arg secret: passphrase to use to generate key
:arg salt: salt string to use when generating key
:param rounds: number of rounds to use to generate key
:arg keylen: number of bytes to generate (if ``None``, uses digest's native size)
:param hash:
    hash function to use. must be name of a hash recognized by hashlib.

:returns:
    raw bytes of generated key

.. note::

    This algorithm has been deprecated, new code should use PBKDF2.
    Among other limitations, ``keylen`` cannot be larger
    than the digest size of the specified hash.

.. deprecated:: 1.7

    This has been relocated to :func:`passlib.crypto.digest.pbkdf1`,
    and this version will be removed in Passlib 2.0.
    *Note the call signature has changed.*
)Ú_pbkdf1)ÚsecretÚsaltÚroundsÚkeylenÚhashs   &&&&&r   r   r   h   s   € ô2 �4 ¨vÓ6Ð6r   c                óÈ   € \        V4      '       g2   \        V\        4      '       d'   VP                  \        4      '       g   \        R4      hVR,          p\        WPWV4      # )a÷  pkcs#5 password-based key derivation v2.0

:arg secret:
    passphrase to use to generate key

:arg salt:
    salt string to use when generating key

:param rounds:
    number of rounds to use to generate key

:arg keylen:
    number of bytes to generate.
    if set to ``None``, will use digest size of selected prf.

:param prf:
    psuedo-random family to use for key strengthening.
    this must be a string starting with ``"hmac-"``, followed by the name of a known digest.
    this defaults to ``"hmac-sha1"`` (the only prf explicitly listed in
    the PBKDF2 specification)

    .. rst-class:: warning

    .. versionchanged 1.7:

        This argument no longer supports arbitrary PRF callables --
        These were rarely / never used, and created too many unwanted codepaths.

:returns:
    raw bytes of generated key

.. deprecated:: 1.7

    This has been deprecated in favor of :func:`passlib.crypto.digest.pbkdf2_hmac`,
    and will be removed in Passlib 2.0.  *Note the call signature has changed.*
z1non-HMAC prfs are not supported as of Passlib 1.7r
   )r   r   r   r   r   ÚNotImplementedErrorr   )r%   r&   r'   r(   Úprfr   s   &&&&& r   Úpbkdf2r-   „   sL   € ôJ �‡}‚}œ C¬×-Ò-°c·n±nÄ^×6TÒ6TÜ!Ð"UÓVÐVØ��W€FÜ�v t°VÓ<Ð<r   c                ó„   € V ^8„  d   Qh/ ^ \         9   d,   \        \        \        \        \        3,          3,          ;R&   # )é   r   )Ú__conditional_annotations__r   r   ÚtupleÚint)Úformats   "r   Ú__annotate__r4      s2   € ÷ ñ ÷H /Ò .ŒG”Cœœs¤C˜x�Ð(Õ)Ñ .òIr   )r"   r   r-   )Úhmac_zhmac-)NÚsha1)Nz	hmac-sha1)r0   Ú__doc__Úcollections.abcr   Úwarningsr   Úpasslib.crypto.digestr   r   r   r   r$   Úpasslib.excr   Ú__all__ÚDeprecationWarningr   r   r"   r-   r4   )r0   s   @r   Ú<module>r>      sb   øðöõ $Ý ÷ñ õ
õ *ò€ñ ðNàôð -/€
Ó .ð $€ò:ôz7ö8(=r   