Ë
    àU.j­§  ã                   ó:  — d Z ddlmZ ddlmZmZmZ ddlm	Z	m
Z
 	 ddlmZ ddlmZ ddlmZ ddlmZ dd	lZdd	lZdd	lZ ej0                  e«      Zdd	lZdd	lZdd	lZdd	lZdd	lZer	 dd	l Z ndd	l Z dd	l"Z"e rdd	l#Z#	 dd	l$Z$dd	l%Z%dd	l&Z&ddl'm(Z( ddl)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6 ddl7m8Z8m9Z9m:Z:m;Z;m<Z< ddl=m>Z>m?Z? ddlm@Z@mAZAmBZBmCZCmDZDmEZEmFZFmGZGmHZHmIZImJZJmKZKmLZLmMZMmNZNmOZOmPZP g d¢ZQ eR ej4                  eFrej¦                  nej¨                  d«      dz   «      ZUg d¢ZVddgZWddl=mXZX dZY eGd«      ZZ eGd«      Z[ eRej¸                  j»                  d«      xs d«      Z^ G d„ de_«      Z`eFr8ejÂ                  jÄ                  Zc edecejÂ                  jÊ                  g«      Zfd„ Zgnd„ Zg	 	 djd!„Zhd"„ Zid#„ ZjejZk	 dd$llmmZj dkd%„Zndld&„Zoe €dld'„Zod(„ ZpeFrd)„ Zqd*„ Zrndd+lmsZsmtZt d,„ Zqd-„ Zr e@eqd.«        e@erd/«       d0„ Zud1„ Zvd2„ Zwd3Zx eGd4«      Zydmd5„Zzd6„ Z{d7Z|e|jû                  d8«      Z~d9„ Zd:„ Z€d;Z� eGd<«      Z‚d=„ Zƒdnd>„Z„dod?„Z…eFrdod@„Z†ndodA„Z† e@e†dB«        e8dCdD¬E«      dpdF„«       Z‡ eddG�j                  «       «      Z‰ eddH�j                  «       «      ZŠ edddIg«      Z‹dqdJ„ZŒdK„ Z�	 ddLlŽmŽZ� dMZ�d4Z‘e$r0ePr.dNe�j$                  cxk  rdOk  rn n e$�j&                  «       Z”dMZ•nddPlm–Z–  e–«       Z”d Z• eGdQ«      Z—eFrdMZ˜	  e�dRdS«       dT„ ZšndMZ˜dU„ Zš	  e@ešdW«       dX„ Z›e%�j8                  Z�e�ZždY„ ZŸ	  e�j@                  dZ«       dMZ¡dmd[„Z£e¡r e�jH                  «       Z¥n e�jL                   e£«       «      Z¥d\„ Z§d]„ Z¨d^Z© e8dDd_d`¬a«      dbe©fdc„«       ZªddZ«de„ Z¬dfZ­dg„ Z®dh„ Z¯di„ Z°y	# e$ r ddlmZ ddlmZ Y �Œ“w xY w# e$ r d	Z d
Z!Y �ŒYw xY w# e$ r d	Z$Y �ŒXw xY w# e$ r Y �Œ"w xY w# e™$ r d Z˜Y Œç Y ŒêxY w# e$ r d	Z�d Z�d Z˜d Z•d	Z”dV„ ZšY Œ÷w xY w# e¢$ r d Z¡Y ŒÐw xY w)rz4passlib.utils -- helpers for writing password hashesé    )ÚJYTHON)Ú
b2a_base64Ú
a2b_base64ÚError)Ú	b64encodeÚ	b64decode)ÚSequence)ÚIterable)Úlookup)Úupdate_wrapperNznot present under Jython)Úwarn)ÚBASE64_CHARSÚ
AB64_CHARSÚHASH64_CHARSÚBCRYPT_CHARSÚBase64EngineÚLazyBase64EngineÚh64Úh64bigÚbcrypt64Úab64_encodeÚab64_decodeÚb64s_encodeÚb64s_decode)Údeprecated_functionÚdeprecated_methodÚmemoized_propertyÚclasspropertyÚhybrid_method)ÚExpectedStringErrorÚExpectedTypeError)Úadd_docÚ
join_bytesÚjoin_byte_valuesÚjoin_byte_elemsÚirangeÚimapÚPY3ÚuÚjoin_unicodeÚunicodeÚbyte_elem_valueÚ
nextgetterÚunicode_or_strÚunicode_or_bytes_typesÚget_method_functionÚsuppress_causeÚPYPY)r   Úsys_bitsÚunix_crypt_schemesÚrounds_cost_valuesÚconsteqÚsaslprepÚ	xor_bytesÚrender_bytesÚis_same_codecÚis_ascii_safeÚto_bytesÚ
to_unicodeÚto_native_strÚ	has_cryptÚ
test_cryptÚ
safe_cryptÚtickÚrngÚgetrandbytesÚ
getrandstrÚgenerate_passwordÚis_crypt_handlerÚis_crypt_contextÚhas_rounds_infoÚhas_salt_infoé   g      ø?)Úsha512_cryptÚsha256_cryptÚ
sha1_cryptÚbcryptÚ	md5_cryptÚ
bsdi_cryptÚ	des_cryptÚlinearÚlog2)ÚMissingBackendErroró    Ú Ú ÚPASSLIB_MAX_PASSWORD_SIZEi   c                   ó:   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
y	)
ÚSequenceMixinzƒ
    helper which lets result object act like a fixed-length sequence.
    subclass just needs to provide :meth:`_as_tuple()`.
    c                 ó   — t        d«      ‚)Nzimplement in subclass)ÚNotImplementedError©Úselfs    úXC:\xampp\htdocs\tradingbinance\backend\.venv\Lib\site-packages\passlib/utils/__init__.pyÚ	_as_tuplezSequenceMixin._as_tuple—   s   € Ü!Ð"9Ó:Ð:rV   c                 ó4   — t        | j                  «       «      S ©N)Úreprra   r^   s    r`   Ú__repr__zSequenceMixin.__repr__š   ó   € Ü�D—N‘NÓ$Ó%Ð%rV   c                 ó(   — | j                  «       |   S rc   ©ra   )r_   Úidxs     r`   Ú__getitem__zSequenceMixin.__getitem__�   s   € Ø�~‰~Ó Ñ$Ð$rV   c                 ó4   — t        | j                  «       «      S rc   )Úiterra   r^   s    r`   Ú__iter__zSequenceMixin.__iter__    rf   rV   c                 ó4   — t        | j                  «       «      S rc   )Úlenra   r^   s    r`   Ú__len__zSequenceMixin.__len__£   s   € Ü�4—>‘>Ó#Ó$Ð$rV   c                 ó(   — | j                  «       |k(  S rc   rh   ©r_   Úothers     r`   Ú__eq__zSequenceMixin.__eq__¦   s   € Ø�~‰~Ó 5Ñ(Ð(rV   c                 ó&   — | j                  |«       S rc   )rt   rr   s     r`   Ú__ne__zSequenceMixin.__ne__©   s   € Ø—;‘;˜uÓ%Ð%Ð%rV   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ra   re   rj   rm   rp   rt   rv   © rV   r`   r[   r[   ’   s*   „ ñò;ò&ò%ò&ò%ò)ó&rV   r[   c                 óè   — t        j                  t        | «      «      j                  }|sy|j	                  |«      }|r|j
                  t        vry|t        |«      d      j
                  t        k(  S )ú*test if function accepts specified keywordFTéÿÿÿÿ)	ÚinspectÚ	signaturer0   Ú
parametersÚgetÚkindÚ_VAR_ANY_SETÚlistÚ_VAR_KEYWORD)ÚfuncÚkeyÚparamsÚargs       r`   Úaccepts_keywordr‹   ³   sa   € ä×"Ñ"Ô#6°tÓ#<Ó=×HÑHˆÙØØ�j‰j˜‹oˆÙ�3—8‘8¤<Ñ/Øà”d˜6“l 2Ñ&Ñ'×,Ñ,´Ñ<Ð<rV   c                 óz   — t        j                  t        | «      «      }||j                  v xs |j                  duS )r}   N)r   Ú
getargspecr0   ÚargsÚkeywords)r‡   rˆ   Úspecs      r`   r‹   r‹   À   s5   € ä×!Ñ!Ô"5°dÓ";Ó<ˆØ�d—i‘iÐÒ< 4§=¡=¸Ð#<Ð<rV   Fc                 óf  ‡— t        |t        «      r|g}t        | j                  «      }|r7t        |t        «      r|g}|D ]  Š|r‰|v rŒ
‰|v sŒ|j	                  ‰«       Œ! |rº|D ]µ  Št        ˆfd„|D «       «      rŒ|r>t        |«      D ]$  \  }}	t        ‰|	«      r nk|sŒt        |	|«      sŒ$ nY t        |«      }nL|rHt        t        |«      «      D ].  \  }
}	t        |	|«      sŒt        |«      |
z
  }||dz
     |	k(  sJ ‚ n d}nd}|j                  |‰«       Œ· |st        |«      | _        yy)a  
    helper to update mixin classes installed in target class.

    :param target:
        target class whose bases will be modified.

    :param add:
        class / classes to install into target's base class list.

    :param remove:
        class / classes to remove from target's base class list.

    :param append:
        by default, prepends mixins to front of list.
        if True, appends to end of list instead.

    :param after:
        optionally make sure all mixins are inserted after
        this class / classes.

    :param before:
        optionally make sure all mixins are inserted before
        this class / classes.

    :param dryrun:
        optionally perform all calculations / raise errors,
        but don't actually modify the class.
    c              3   ó6   •K  — | ]  }t        |‰«      –— Œ y ­wrc   )Ú
issubclass)Ú.0ÚbaseÚmixins     €r`   Ú	<genexpr>z'update_mixin_classes.<locals>.<genexpr>ö   s   øè ø€ Ð=±u¨t”:˜d E×*±uùó   ƒé   r   N)Ú
isinstanceÚtyper…   Ú	__bases__ÚremoveÚanyÚ	enumerater“   ro   ÚreversedÚinsertÚtuple)ÚtargetÚaddr�   ÚappendÚbeforeÚafterÚdryrunÚbasesri   r•   Úend_idxr–   s              @r`   Úupdate_mixin_classesr«   Å   sE  ø€ ô< �#”tÔØˆeˆä�×!Ñ!Ó"€Eñ Ü�fœdÔ#Ø�XˆFÛˆEÙ�u ‘|ØØ˜Š~Ø—‘˜UÕ#ð	 ñ ÛˆEäÓ=±uÓ=Ô=Øñ Ü!*¨5Ö!1‘I�C˜Ü! %¨Ô.áÚ¤*¨T°6Õ":áð "2ô ˜e›*‘CÙÜ%.¬x¸«Ö%?‘M�G˜TÜ! $¨Õ.ä! %›j¨7Ñ2˜Ø$ S¨¡U™|¨tÒ3Ð3Ð3Ùð &@ð ‘Cð �ð �L‰L˜˜eÕ$ð? ñD Ü  ›<ˆÕð rV   c              #   ó~  K  — |dk  rt        d«      ‚t        | t        «      r(t        | «      }d}||k  r||z   }| || –— |}||k  rŒyyt        | t        «      rHt        | «      }	 t        j                  ||«      }	 t        |«      }t        j                  |f|«      –— Œ<t        d«      ‚# t        $ r Y yw xY w­w)z8
    split iterable into chunks of <size> elements.
    r™   zsize must be positive integerr   zsource must be iterableN)Ú
ValueErrorrš   r	   ro   r
   rl   Ú	itertoolsÚisliceÚnextÚStopIterationÚchainÚ	TypeError)ÚsourceÚsizeÚendÚiÚnÚitrÚ	chunk_itrÚfirsts           r`   Úbatchr¼     sÐ   è ø€ ð ˆa‚xÜÐ8Ó9Ð9Ü�&œ(Ô#Ü�&‹kˆØˆØ�#ŠgØ�D‘ˆAØ˜˜1�+ÒØˆAð �#�gô 
�FœHÔ	%Ü�6‹lˆØÜ!×(Ñ(¨¨dÓ3ˆIðÜ˜Y›�ô —/‘/ 5 (¨IÓ6Ò6ð ô Ð1Ó2Ð2øô	 !ò Ùðüs0   ‚AB=Á	4B=Á>B. Â	%B=Â.	B:Â7B=Â9B:Â:B=c                 óÊ  — t        | t        «      rt        |t        «      st        d«      ‚d}n=t        | t        «      r"t        |t        «      st        d«      ‚t        }nt        d«      ‚t        | «      t        |«      k(  }|r| }d}|s|}d}|r!t        |«      D ]  \  }}||z  z  }Œ dk(  S t        |«      D ]  \  }}t        |«      t        |«      z  z  }Œ! dk(  S )aç  Check two strings/bytes for equality.

    This function uses an approach designed to prevent
    timing analysis, making it appropriate for cryptography.
    a and b must both be of the same type: either str (ASCII only),
    or any type that supports the buffer protocol (e.g. bytes).

    Note: If a and b are of different lengths, or if an error occurs,
    a timing attack could theoretically reveal information about the
    types and lengths of a and b--but not their values.
    z)inputs must be both unicode or both bytesFr   r™   )rš   r+   r³   Úbytesr(   ro   ÚzipÚord)ÚleftÚrightÚis_py3_bytesÚ	same_sizeÚtmpÚresultÚlÚrs           r`   r6   r6   ;  sò   € ô* �$œÔ Ü˜%¤Ô)ÜÐGÓHÐHØ‰Ü	�Dœ%Ô	 Ü˜%¤Ô'ÜÐGÓHÐHÜ‰äÐCÓDÐDô �T“œc %›jÑ(€IÙàˆØˆÙð ˆØˆñ Ü�s˜E–?‰CˆAˆaØ�a˜!‘e‰O‰Fð #ð
 �Q‰;Ðô �s˜E–?‰CˆAˆaØ”c˜!“fœs 1›v‘oÑ%‰Fð #à�Q‰;ÐrV   )Úcompare_digestc                 óº   — | j                  «       } | j                  |«      r| dd } | sg S | j                  |«      D �cg c]  }|j                  «       ‘Œ c}S c c}w )zRsplit comma-separated string into list of elements,
    stripping whitespace.
    Nr~   )ÚstripÚendswithÚsplit)r´   ÚsepÚelems      r`   Ú
splitcommarÐ   †  sW   € ð �\‰\‹^€FØ‡��sÔØ˜˜�ˆÙØˆ	Ø&,§l¡l°3Ô&7Ó9Ñ&7˜dˆT�Z‰Z�\Ð&7Ñ9Ð9ùÒ9s   ¾Ac                 ó®  ‡‡— t        | t        «      st        dt        | «      ›�«      ‚t        j
                  Št        j                  Št        ˆˆfd„| D «       «      }t        j                  d|«      }|st        S t        j                  } ||d   «      r* ||d   «      st        d|z   «      ‚t        j                  }n|}t        j                  }t        j                  }t        j                   }t        j"                  }t        j$                  }	t        j&                  }
t        j(                  }t        j*                  }t        j,                  }|D ]ü  } ‰|«      rJ d«       ‚ ‰|«      rJ d«       ‚ ||«      rt        d	|z   «      ‚ ||«      rt        d
|z   «      ‚ ||«      rt        d|z   «      ‚ ||«      rt        d|z   «      ‚ |	|«      rt        d|z   «      ‚ |
|«      rt        d|z   «      ‚ ||«      rt        d|z   «      ‚ ||«      rt        d|z   «      ‚ ||«      rt        d|z   «      ‚ ||«      sŒðt        d|z   «      ‚ |S )a  Normalizes unicode strings using SASLPrep stringprep profile.

    The SASLPrep profile is defined in :rfc:`4013`.
    It provides a uniform scheme for normalizing unicode usernames
    and passwords before performing byte-value sensitive operations
    such as hashing. Among other things, it normalizes diacritic
    representations, removes non-printing characters, and forbids
    invalid characters such as ``\n``. Properly internationalized
    applications should run user passwords through this function
    before hashing.

    :arg source:
        unicode string to normalize & validate

    :param param:
        Optional noun identifying source parameter in error messages
        (Defaults to the string ``"value"``). This is mainly useful to make the caller's error
        messages make more sense contextually.

    :raises ValueError:
        if any characters forbidden by the SASLPrep profile are encountered.

    :raises TypeError:
        if input is not :class:`!unicode`

    :returns:
        normalized unicode string

    .. note::

        This function is not available under Jython,
        as the Jython stdlib is missing the :mod:`!stringprep` module
        (`Jython issue 1758320 <http://bugs.jython.org/issue1758320>`_).

    .. versionadded:: 1.6
    z"input must be unicode string, not c              3   óN   •K  — | ]  } ‰|«      s ‰|«      rt         n|–— Œ y ­wrc   )Ú_USPACE)r”   ÚcÚin_table_b1Úin_table_c12s     €€r`   r—   zsaslprep.<locals>.<genexpr>Æ  s+   øè ø€ ð 
áˆAÙ˜1Œ~ñ   ”?�¨Ó)Ùùs   ƒ"%ÚNFKCr   r~   zmalformed bidi sequence in z$failed to strip B.1 in mapping stagez(failed to replace C.1.2 in mapping stagez$unassigned code points forbidden in z control characters forbidden in z$private use characters forbidden in z"non-char code points forbidden in zsurrogate codes forbidden in z!non-plaintext chars forbidden in z!non-canonical chars forbidden in z1display-modifying / deprecated chars forbidden inztagged characters forbidden in zforbidden bidi character in )rš   r+   r³   r›   Ú
stringpreprÖ   rÕ   r*   ÚunicodedataÚ	normalizeÚ_UEMPTYÚin_table_d1r­   Úin_table_d2Úin_table_a1Úin_table_c21_c22Úin_table_c3Úin_table_c4Úin_table_c5Úin_table_c6Úin_table_c7Úin_table_c8Úin_table_c9)r´   ÚparamÚdataÚis_ral_charÚis_forbidden_bidi_charrÞ   rß   rà   rá   râ   rã   rä   rå   ræ   rÔ   rÕ   rÖ   s                  @@r`   r7   r7   ‘  s]  ù€ ôX �fœgÔ&ÝÜ˜fœð(ó )ð 	)ô ×*Ñ*€LÜ×(Ñ(€KÜô 
áó
ó 
€Dô × Ñ  ¨Ó.€DÙÜˆô ×(Ñ(€KÙ�4˜‘7ÔÙ˜4 ™8Ô$ÜÐ:¸UÑBÓCÐCä!+×!7Ñ!7Ñð "-Ðô ×(Ñ(€KÜ!×2Ñ2ÐÜ×(Ñ(€KÜ×(Ñ(€KÜ×(Ñ(€KÜ×(Ñ(€KÜ×(Ñ(€KÜ×(Ñ(€KÜ×(Ñ(€KÛˆá˜q”>ÐIÐ#IÓIÐ!Ù ”?ÐNÐ$NÓNÐ"ñ �qŒ>ÜÐCÀeÑKÓLÐLÙ˜AÔÜÐ?À%ÑGÓHÐHÙ�qŒ>ÜÐCÀeÑKÓLÐLÙ�qŒ>ÜÐAÀEÑIÓJÐJÙ�qŒ>ÜÐ<¸uÑDÓEÐEÙ�qŒ>ÜÐ@À5ÑHÓIÐIÙ�qŒ>ô Ð@À5ÑHÓIÐIÙ�qŒ>Üð ,Ø.3ñ4ó 5ð 5á�qŒ>ÜÐ>ÀÑFÓGÐGñ " !Õ$ÜÐ;¸eÑCÓDÐDð= ð@ €KrV   c                 ó&   — t        dt        z   «      ‚)zstub for saslprep()z>saslprep() support requires the 'stringprep' module, which is )r]   Ú_stringprep_missing_reason)r´   rç   s     r`   r7   r7     s   € ä!ð #0Ü2Lñ#Mó Nð 	NrV   c                 ó�   — t        | t        «      r| j                  d«      } | t        d„ |D «       «      z  }|j	                  d«      S )a   Peform ``%`` formating using bytes in a uniform manner across Python 2/3.

    This function is motivated by the fact that
    :class:`bytes` instances do not support ``%`` or ``{}`` formatting under Python 3.
    This function is an attempt to provide a replacement:
    it converts everything to unicode (decoding bytes instances as ``latin-1``),
    performs the required formatting, then encodes the result to ``latin-1``.

    Calling ``render_bytes(source, *args)`` should function roughly the same as
    ``source % args`` under Python 2.

    .. todo::
        python >= 3.5 added back limited support for bytes %,
        can revisit when 3.3/3.4 is dropped.
    úlatin-1c              3   ób   K  — | ]'  }t        |t        «      r|j                  d «      n|–— Œ) y­w)rî   N)rš   r¾   Údecode)r”   rŠ   s     r`   r—   zrender_bytes.<locals>.<genexpr>,  s3   è ø€ ð 6Ù04¨ô 6@ÀÄUÔ5K˜CŸJ™J yÔ1Ø!$ó%Ù04ùs   ‚-/)rš   r¾   rð   r¢   Úencode)r´   rŽ   rÆ   s      r`   r9   r9     sI   € ô  �&œ%Ô Ø—‘˜yÓ)ˆØ”eñ 6Ù04ó6ó 6ñ 6€Fà�=‰=˜Ó#Ð#rV   c                 ó.   — t         j                  | d«      S ©NÚbig)ÚintÚ
from_bytes©Úvalues    r`   Úbytes_to_intrù   2  s   € Ü�~‰~˜e UÓ+Ð+rV   c                 ó&   — | j                  |d«      S ró   )r<   ©rø   Úcounts     r`   Úint_to_bytesrý   4  s   € Ø�~‰~˜e UÓ+Ð+rV   )ÚhexlifyÚ	unhexlifyc                 ó,   — t        t        | «      d«      S )Né   )rõ   rþ   r÷   s    r`   rù   rù   9  s   € Ü”7˜5“> "Ó%Ð%rV   c                 ó*   — t        d|dz  z  | z  «      S )Nz%%0%dxr™   )rÿ   rû   s     r`   rý   rý   ;  s   € Ü˜( e¨Q¡hÑ/°5Ñ8Ó9Ð9rV   z/decode byte string as single big-endian integerz/encode integer as single big-endian byte stringc                 óV   — t        t        | «      t        |«      z  t        | «      «      S )z;Perform bitwise-xor of two byte strings (must be same size))rý   rù   ro   ©rÁ   rÂ   s     r`   r8   r8   A  s"   € äœ TÓ*¬\¸%Ó-@Ñ@Ä#ÀdÃ)ÓLÐLrV   c                 ó:   — d|dz
  t        | «      z  z   }| |z  d| S )zE
    repeat or truncate <source> string, so it has length <size>
    r™   N)ro   ©r´   rµ   Úmults      r`   Úrepeat_stringr  E  s,   € ð ��q‘œS ›[Ñ(Ñ(€DØ�T‰M˜5˜DÐ!Ð!rV   c                 óH   — d|dz
  t        | «      z  z   }t        | |z  |«      S )zN
    variant of repeat_string() which truncates to nearest UTF8 boundary.
    r™   )ro   Úutf8_truncater  s      r`   Úutf8_repeat_stringr  M  s,   € ð ��q‘œS ›[Ñ(Ñ(€DÜ˜ $™¨Ó-Ð-rV   ó    Ú c                 ó~   — t        | «      }||kD  r)|€t        | t        «      rt        nt        }| |||z
  z  z   S | d| S )z>right-pad or truncate <source> string, so it has length <size>N)ro   rš   r+   Ú_UNULLÚ_BNULL)r´   rµ   ÚpadÚcurs       r`   Úright_pad_stringr  X  sF   € ä
ˆf‹+€CØˆc‚zØˆ;Ü& v¬wÔ7•&¼VˆCØ�c˜4 ™8‘nÑ$Ð$à�e�tˆ}ÐrV   c                 ó6  ‡ ‡— t        ‰ t        «      st        ‰ t        d«      ‚t        ‰ «      }|dk  rt	        d||z   «      }||k\  r‰ S t        |dz   |«      }||k  r t        ‰ |   «      dz  dk7  rn|dz  }||k  rŒ ||k(  sJ ‚‰ d| Šˆˆ fd„} |«       sJ ‚‰S )	aÃ  
    helper to truncate UTF8 byte string to nearest character boundary ON OR AFTER <index>.
    returned prefix will always have length of at least <index>, and will stop on the
    first byte that's not a UTF8 continuation byte (128 - 191 inclusive).
    since utf8 should never take more than 4 bytes to encode known unicode values,
    we can stop after ``index+3`` is reached.

    :param bytes source:
    :param int index:
    :rtype: bytes
    r´   r   é   éÀ   é€   r™   Nc                  óŒ   •— 	 ‰j                  d«      } | j                  ‰j                  d«      «      sJ ‚y# t        $ r Y yw xY w)Núutf-8T)rð   ÚUnicodeDecodeErrorÚ
startswith)ÚtextrÆ   r´   s    €€r`   Úsanity_checkz#utf8_truncate.<locals>.sanity_check–  sJ   ø€ ð	Ø—=‘= Ó)ˆDð �‰˜vŸ}™}¨WÓ5Ô6Ð6Ð6Øøô "ò 	áð	ús   ƒ7 ·	AÁA)rš   r¾   r!   ro   ÚmaxÚminr,   )r´   Úindexr¶   r  rÆ   s   `   @r`   r
  r
  c  sÃ   ù€ ô2 �fœeÔ$Ü ¬¨xÓ8Ð8ô ˆf‹+€CØˆq‚yÜ�A�u˜s‘{Ó#ˆØ�‚|Øˆô ˆe�a‰i˜Ó
€Cð �#Š+Ü˜6 %™=Ó)¨DÑ0°DÒ8àà�‰
ˆð �#‹+ð ˜Š|Ðˆ|ð �F�Uˆ^€Fõ
ñ Œ>Ðˆ>à€MrV   s	    
 aA:#!Úasciic                 ó:   — t         j                  | «      t        k(  S )zRTest if codec is compatible with 7-bit ascii (e.g. latin-1, utf-8; but not utf-16))Ú_ASCII_TEST_UNICODErñ   Ú_ASCII_TEST_BYTES)Úcodecs    r`   Úis_ascii_codecr&  ¬  s   € ä×%Ñ% eÓ,Ô0AÑAÐArV   c                 ón   — | |k(  ry| r|syt        | «      j                  t        |«      j                  k(  S )z3Check if two codec names are aliases for same codecTF)Ú_lookup_codecÚnamer  s     r`   r:   r:   °  s5   € àˆu‚}ØÙ‘UØÜ˜Ó×#Ñ#¤}°UÓ';×'@Ñ'@Ñ@Ð@rV   r  ô   Â€c                 ód   ‡— t        | t        «      rt        nt        Št	        ˆfd„| D «       «      S )z<Check if string (bytes or unicode) contains only 7-bit asciic              3   ó(   •K  — | ]	  }|‰k  –— Œ y ­wrc   r{   )r”   rÔ   rÈ   s     €r`   r—   z is_ascii_safe.<locals>.<genexpr>½  s   øè ø€ Ð%™f˜ˆq�1�u™fùs   ƒ)rš   r¾   Ú_B80Ú_U80Úall)r´   rÈ   s    @r`   r;   r;   º  s$   ø€ ä˜6¤5Ô)�¬t€AÜÓ%™fÓ%Ó%Ð%rV   c                 óä   — |sJ ‚t        | t        «      r0|r,t        ||«      s | j                  |«      j	                  |«      S | S t        | t
        «      r| j	                  |«      S t        | |«      ‚)a  Helper to normalize input to bytes.

    :arg source:
        Source bytes/unicode to process.

    :arg encoding:
        Target encoding (defaults to ``"utf-8"``).

    :param param:
        Optional name of variable/noun to reference when raising errors

    :param source_encoding:
        If this is specified, and the source is bytes,
        the source will be transcoded from *source_encoding* to *encoding*
        (via unicode).

    :raises TypeError: if source is not unicode or bytes.

    :returns:
        * unicode strings will be encoded using *encoding*, and returned.
        * if *source_encoding* is not specified, byte strings will be
          returned unchanged.
        * if *source_encoding* is specified, byte strings will be transcoded
          to *encoding*.
    )rš   r¾   r:   rð   rñ   r+   r    )r´   Úencodingrç   Úsource_encodings       r`   r<   r<   ¿  sf   € ñ4 €Oˆ8Ü�&œ%Ô Ù¤=°À(Ô#KØ—=‘= Ó1×8Ñ8¸ÓBÐBàˆMÜ	�FœGÔ	$Ø�}‰}˜XÓ&Ð&ä! &¨%Ó0Ð0rV   c                 óˆ   — |sJ ‚t        | t        «      r| S t        | t        «      r| j                  |«      S t	        | |«      ‚)a¼  Helper to normalize input to unicode.

    :arg source:
        source bytes/unicode to process.

    :arg encoding:
        encoding to use when decoding bytes instances.

    :param param:
        optional name of variable/noun to reference when raising errors.

    :raises TypeError: if source is not unicode or bytes.

    :returns:
        * returns unicode strings unchanged.
        * returns bytes strings decoded using *encoding*
    )rš   r+   r¾   rð   r    ©r´   r1  rç   s      r`   r=   r=   ä  s@   € ñ$ €Oˆ8Ü�&œ'Ô"ØˆÜ	�FœEÔ	"Ø�}‰}˜XÓ&Ð&ä! &¨%Ó0Ð0rV   c                 ó€   — t        | t        «      r| j                  |«      S t        | t        «      r| S t	        | |«      ‚rc   )rš   r¾   rð   r+   r    r4  s      r`   r>   r>   ÿ  s7   € Ü�fœeÔ$Ø—=‘= Ó*Ð*Ü˜¤Ô(ØˆMä% f¨eÓ4Ð4rV   c                 ó€   — t        | t        «      r| S t        | t        «      r| j                  |«      S t	        | |«      ‚rc   )rš   r¾   r+   rñ   r    r4  s      r`   r>   r>     s7   € Ü�fœeÔ$ØˆMÜ˜¤Ô(Ø—=‘= Ó*Ð*ä% f¨eÓ4Ð4rV   a>  Take in unicode or bytes, return native string.

    Python 2: encodes unicode using specified encoding, leaves bytes alone.
    Python 3: leaves unicode alone, decodes bytes using specified encoding.

    :raises TypeError: if source is not unicode or bytes.

    :arg source:
        source unicode or bytes string.

    :arg encoding:
        encoding to use when encoding unicode or decoding bytes.
        this defaults to ``"utf-8"``.

    :param param:
        optional name of variable/noun to reference when raising errors.

    :returns: :class:`str` instance
    z1.6z1.7)Ú
deprecatedÚremovedc                 ó   — t        | |d¬«      S )z'deprecated, use to_native_str() insteadÚhash)rç   )r>   )r´   r1  s     r`   Úto_hash_strr;  $  s   € ô ˜ °Ô8Ð8rV   z true t yes y on 1 enable enabledz#false f no n off 0 disable disabledÚnonec                 ó  — |dv sJ ‚t        | t        «      rK| j                  «       j                  «       }|t        v ry|t
        v ry|t        v r|S t        d|›d| ›�«      ‚t        | t        «      r| S | €|S t        | «      S )z\
    helper to convert value to boolean.
    recognizes strings such as "true", "false"
    )TFNTFzunrecognized z value: )	rš   r/   ÚlowerrË   Ú	_true_setÚ
_false_setÚ	_none_setr­   Úbool)rø   r<  rç   Úcleans       r`   Úas_boolrD  -  sˆ   € ð
 Ð&Ñ&Ð&Ð&Ü�%Ô/Ô0Ø—‘“×#Ñ#Ó%ˆØ”IÑØØ”JÑØØ”IÑØˆKÝº¹uÐEÓFÐFÜ	�Eœ4Ô	 ØˆØ	ˆØˆä�E‹{ÐrV   c                 ót   — t         st        | t        «      sy	 | j                  d«       y# t        $ r Y yw xY w)zƒ
    UT helper --
    test if value is safe to pass to crypt.crypt();
    under PY3, can't pass non-UTF8 bytes to crypt.crypt.
    Tr  F)Úcrypt_accepts_bytesrš   r¾   rð   r  r÷   s    r`   Úis_safe_crypt_inputrG  G  s9   € õ ¤*¨U´EÔ":ØðØ�‰�WÔØøÜò Ùðús   ™+ «	7¶7)ÚcryptT)é   rK   r   )rI  r  r  )Únullcontextz*:!ó   îÚxxc                 óŽ  — t         rVt        | t        «      r| j                  d«      } t        | v rt        d«      ‚t        |t        «      r…|j                  d«      }nst        | t        «      r/| }	 | j                  d«      } | j                  d«      |k(  sJ d«       ‚t        | v rt        d«      ‚t        |t        «      r|j                  d«      }	 t        5  t        | |«      }d d d «       t        t        «      r|j                  d«      }|r|d   t        v ry |S # t        $ r Y y w xY w# 1 sw Y   ŒIxY w# t        $ r Y y w xY w)Nr  únull character in secretr!  z"utf-8 spec says this can't happen!r   )rF  rš   r+   rñ   r  r­   r¾   rð   r  Ú_NULLÚ_safe_crypt_lockÚ_cryptÚOSErrorÚ_invalid_prefixes)Úsecretr:  ÚorigrÆ   s       r`   rA   rA   ˆ  s9  € Ý"ô ˜f¤gÔ.Ø#Ÿ]™]¨7Ó3�FÜ˜VÑ#Ü$Ð%?Ó@Ð@Ü˜d¤GÔ,ØŸ;™; wÓ/‘Dô
 ˜f¤eÔ,Ø!�Dð$Ø!'§¡¨wÓ!7˜ð
 "Ÿ=™=¨Ó1°TÒ9ð EØ DóEÐ9ä˜F‘?Ü$Ð%?Ó@Ð@Ü˜d¤EÔ*ØŸ;™; wÓ/�DðÞ%Ü# F¨DÓ1�F÷ &ô ˜&¤%Ô(ØŸ™ wÓ/�Ù˜V A™YÔ*;Ñ;ØØˆMøô3 .ò $Ù#ð$ú÷ &Ð%ûäò ñ ð	ús<   Á0D ÃD8 ÃD,Ã$D8 Ä	D)Ä(D)Ä,D5Ä1D8 Ä8	EÅEc                 ó>  — t        | t        «      r| j                  d«      } t        | v rt	        d«      ‚t        |t        «      r|j                  d«      }t
        5  t        | |«      }d d d «       sy |j                  d«      }|d   t        v ry |S # 1 sw Y   Œ+xY w)Nr  rN  r!  r   )	rš   r+   rñ   rO  r­   rP  rQ  rð   rS  )rT  r:  rÆ   s      r`   rA   rA   º  s‹   € Ü˜&¤'Ô*ØŸ™ wÓ/�Ü˜‰Ü Ð!;Ó<Ð<Ü˜$¤Ô(Ø—{‘{ 7Ó+�Þ!Ü ¨Ó-�÷ "áØØ—]‘] 7Ó+ˆFØ�a‰yÔ-Ñ-ØØˆM÷ "Ð!ús   ÁBÂBc                  ó   — y rc   r{   ©rT  r:  s     r`   rA   rA   ]  s   € ØrV   aì  Wrapper around stdlib's crypt.

    This is a wrapper around stdlib's :func:`!crypt.crypt`, which attempts
    to provide uniform behavior across Python 2 and 3.

    :arg secret:
        password, as bytes or unicode (unicode will be encoded as ``utf-8``).

    :arg hash:
        hash or config string, as ascii bytes or unicode.

    :returns:
        resulting hash as ascii unicode; or ``None`` if the password
        couldn't be hashed due to one of the issues:

        * :func:`crypt()` not available on platform.

        * Under Python 3, if *secret* is specified as bytes,
          it must be use ``utf-8`` or it can't be passed
          to :func:`crypt()`.

        * Some OSes will return ``None`` if they don't recognize
          the algorithm being used (though most will simply fall
          back to des-crypt).

        * Some OSes will return an error string if the input config
          is recognized but malformed; current code converts these to ``None``
          as well.
    c                 óx   — t        |t        «      sJ dt        |«      z  «       ‚|sJ d«       ‚t        | |«      |k(  S )z°check if :func:`crypt.crypt` supports specific hash
    :arg secret: password to test
    :arg hash: known hash of password to use as reference
    :returns: True or False
    z#hash must be unicode_or_str, got %szhash must be non-empty)rš   r.   r›   rA   rX  s     r`   r@   r@   è  sG   € ô �dœNÔ+ð ;Ø-´°T³
Ñ:ó;Ð+áÐ)Ð)Ó)ˆ4Ü�f˜dÓ# tÑ+Ð+rV   c                 ó”   — t        j                  d| «      }|r0t        d„ |j                  d«      j	                  d«      D «       «      S y)zhelper to parse version stringz(\d+(?:\.\d+)+)c              3   ó2   K  — | ]  }t        |«      –— Œ y ­wrc   )rõ   )r”   rÏ   s     r`   r—   z parse_version.<locals>.<genexpr>ÿ  s   è ø€ ÐAÑ+@ 4”S˜—YÑ+@ùs   ‚r™   Ú.N)ÚreÚsearchr¢   ÚgrouprÍ   )r´   Úms     r`   Úparse_versionra  û  s=   € ä
�	‰	Ð$ fÓ-€AÙÜÑA¨1¯7©7°1«:×+;Ñ+;¸CÔ+@ÓAÓAÐAØrV   r™   c           	      ó  — ddl m} t        | d«      rt        | d«      r	 | j                  «       } t        d«      | t        t        d«      rt        j                  «       ndt        t        «       «      t        j                  «       t        «       t        r$t        j                  d	«      j                  d
«      ndfz  }t!         ||j#                  d«      «      j%                  «       d«      S # t        $ r | j                  d«      } Y ŒØw xY w)z.generate prng seed value from system resourcesr   )Úsha512ÚgetstateÚgetrandbitsi €  z%s %s %s %.15f %.15f %sÚgetpidNé    rî   r  r  )Úhashlibrc  Úhasattrrd  r]   re  r)   Úosrf  ÚidÚobjectÚtimerB   Úhas_urandomÚurandomrð   rõ   rñ   Ú	hexdigest)rø   rc  r  s      r`   Úgenseedrq    sÙ   € åÜˆu�jÔ!¤g¨e°]Ô&Cð	/Ø—N‘NÓ$ˆEô
 Ð&Ó'àô œr 8Ô,Œ�	‰	Œ°$ô 	Œ6‹8‹ô 	�	‰	‹Ü‹õ -8Œ�
‰
�2‹×Ñ˜iÔ(¸Qð#+
ñ 
€Dô( ‰v�d—k‘k 'Ó*Ó+×5Ñ5Ó7¸Ó<Ð<øô1 #ò 	/ð ×%Ñ% gÓ.ŠEð	/ús    C, Ã,D	ÄD	c                 óB   ‡ ‡— ‰st         S ˆˆ fd„}t         |«       «      S )z]return byte-string containing *count* number of randomly generated bytes, using specified rngc               3   ót   •K  — ‰j                  ‰dz  «      } d}|‰k  r| dz  –— | dz  } |dz  }|‰k  rŒy y ­w)Nr  r   éÿ   r™   )re  )rø   r·   rü   rC   s     €€r`   Úhelperzgetrandbytes.<locals>.helperM  sJ   øè ø€ à—‘  q¡Ó)ˆØˆØ�%ŠiØ˜$‘,ÒØ�a‰KˆEØ�‰FˆAð �%�iùs   ƒ28¶8)Ú_BEMPTYr$   )rC   rü   ru  s   `` r`   rD   rD   B  s!   ù€ ñ Üˆõô ™F›HÓ%Ð%rV   c                 óä   ‡ ‡‡‡— ‰dk  rt        d«      ‚t        ‰«      Š‰dk(  rt        d«      ‚‰dk(  r‰‰z  S ˆˆˆˆ fd„}t        ‰t        «      rt	         |«       «      S t         |«       «      S )z|return string containing *count* number of chars/bytes, whose elements are drawn from specified charset, using specified rngr   zcount must be >= 0zalphabet must not be emptyr™   c               3   ó|   •K  — ‰j                  d‰‰z  «      } d}|‰k  r‰| ‰z     –— | ‰z  } |dz  }|‰k  rŒy y ­w)Nr   r™   )Ú	randrange)rø   r·   Úcharsetrü   ÚlettersrC   s     €€€€r`   ru  zgetrandstr.<locals>.helperf  sR   øè ø€ à—‘˜a ¨%¡Ó0ˆØˆØ�%ŠiØ˜% '™/Ñ*Ò*Ø�gÑˆEØ�‰FˆAð �%�iùs   ƒ6<º<)r­   ro   rš   r+   r*   r%   )rC   rz  rü   ru  r{  s   ``` @r`   rE   rE   W  sp   û€ ð ˆq‚yÜÐ-Ó.Ð.Ü�'‹l€GØ�!‚|ÜÐ5Ó6Ð6Ø�!‚|Ø˜‰Ð÷ô �'œ7Ô#Ü™F›HÓ%Ð%ä™v›xÓ(Ð(rV   Ú42346789ABCDEFGHJKMNPQRTUVWXYZabcdefghjkmnpqrstuvwxyzz2.0z/passlib.pwd.genword() / passlib.pwd.genphrase())r7  r8  Úreplacementé
   c                 ó$   — t        t        || «      S )aw  generate random password using given length & charset

    :param size:
        size of password.

    :param charset:
        optional string specified set of characters to draw from.

        the default charset contains all normal alphanumeric characters,
        except for the characters ``1IiLl0OoS5``, which were omitted
        due to their visual similarity.

    :returns: :class:`!str` containing randomly generated password.

    .. note::

        Using the default character set, on a OS with :class:`!SystemRandom` support,
        this function should generate passwords with 5.7 bits of entropy per character.
    )rE   rC   )rµ   rz  s     r`   rF   rF   v  s   € ô, ”c˜7 DÓ)Ð)rV   )r)  Úsetting_kwdsÚcontext_kwdsÚverifyr:  Úidentifyc                 ó4   ‡ — t        ˆ fd„t        D «       «      S )z4check if object follows the :ref:`password-hash-api`c              3   ó6   •K  — | ]  }t        ‰|«      –— Œ y ­wrc   ©ri  ©r”   r)  Úobjs     €r`   r—   z#is_crypt_handler.<locals>.<genexpr>š  ó   øè ø€ Ð=©n dŒw�s˜D×!©nùr˜   )r/  Ú_handler_attrs©rˆ  s   `r`   rG   rG   —  ó   ø€ ô Ó=­nÓ=Ó=Ð=rV   )Úneeds_updateÚ	genconfigÚgenhashr‚  Úencryptrƒ  c                 ó4   ‡ — t        ˆ fd„t        D «       «      S )zOcheck if object appears to be a :class:`~passlib.context.CryptContext` instancec              3   ó6   •K  — | ]  }t        ‰|«      –— Œ y ­wrc   r†  r‡  s     €r`   r—   z#is_crypt_context.<locals>.<genexpr>¥  r‰  r˜   )r/  Ú_context_attrsr‹  s   `r`   rH   rH   ¢  rŒ  rV   c                 ó@   — d| j                   v xr t        | dd«      duS )z_check if handler provides the optional :ref:`rounds information <rounds-attributes>` attributesÚroundsÚ
min_roundsN©r€  Úgetattr©Úhandlers    r`   rI   rI   ¬  s+   € à˜×,Ñ,Ð,ò =Ü�G˜\¨4Ó0¸Ð<ð>rV   c                 ó@   — d| j                   v xr t        | dd«      duS )z[check if handler provides the optional :ref:`salt information <salt-attributes>` attributesÚsaltÚmin_salt_sizeNr—  r™  s    r`   rJ   rJ   ±  s-   € à�g×*Ñ*Ð*ò @Ü�G˜_¨dÓ3¸4Ð?ðArV   )NNFNNF)Ú,r÷   rc   )r  rø   N)r  rø   )r!  )NÚboolean)±rz   Úpasslib.utils.compatr   Úbinasciir   r   r   Ú_BinAsciiErrorÚbase64r   r   Úcollections.abcr	   r
   ÚImportErrorÚcollectionsÚcodecsr   r(  Ú	functoolsr   r®   r   ÚloggingÚ	getLoggerrw   ÚlogÚmathrj  ÚsysÚrandomr]  rØ   rì   rm  rÙ   Ú	threadingÚtimeitÚtypesÚwarningsr   Úpasslib.utils.binaryr   r   r   r   r   r   r   r   r   r   r   r   r   Úpasslib.utils.decorr   r   r   r   r   Úpasslib.excr    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   Ú__all__rõ   ÚmaxsizeÚmaxintr3   r4   r5   rU   rv  rÛ   rÓ   Úenvironr‚   ÚMAX_PASSWORD_SIZErl  r[   Ú	ParameterÚVAR_KEYWORDr†   ÚsetÚVAR_POSITIONALr„   r‹   r«   r¼   r6   Ústr_consteqÚhmacrÉ   rÐ   r7   r9   rù   rý   rþ   rÿ   r8   r  r  r  r  r  r
  r$  rð   r#  r&  r:   r-  r.  r;   r<   r=   r>   r;  rÍ   r?  r@  rA  rD  rG  rH  rQ  r?   rO  Úpypy_version_infoÚLockrP  Úcrypt_needs_lockrJ  rS  rF  r³   rA   r@   Údefault_timerÚtimerrB   ra  ro  rn  r]   rq  ÚSystemRandomrC   ÚRandomrD   rE   Ú
_52charsetrF   rŠ  rG   r“  rH   rI   rJ   r{   rV   r`   Ú<module>rÉ     s"  ðÙ :õ (ç DÑ Dß 'ð%Ý(Ý(õ
 +Ý $Û Û Û Ð'�g×'Ñ'¨Ó1�Û Û 	Û 
Û Û 	Ù	ð@Üó
 Û ÙÛðÛó Û Ý ÷÷ ÷ õ ÷õ ÷ ?÷M÷ M÷ M÷ Mõ Mò'€ñ\ ˆxˆt�x‰x¡s˜Ÿš°·
±
¸AÓ>ÀÑDÓE€òÐ ð   Ð)Ð õ ,ð €Ù
ˆB‹%€Ù
ˆC‹&€ñ ˜Ÿ
™
Ÿ™Ð'BÓCÒKÀtÓLÐ ô&�Fô &ñ4 ð ×$Ñ$×0Ñ0€LÙ˜ g×&7Ñ&7×&FÑ&FÐGÓH€Ló	=ò=ð
 @EØ9>óR(òn3ò>8ð| €ð	å.ó	:ó}ð@ ÐóNò$ñ, ò,ó,÷ ,ò&ò:ñ ˆÐGÔ HÙ ˆÐGÔ HòMò"ò.ð 
€Ù	
ˆ6‹€óòAðL (Ð Ø'×.Ñ.¨wÓ7Ð òBòAð €Ùˆƒy€ò&ó
#1óJ1ñ4 ô5ó5ñ ˆðô	ñ*  ¨uÔ5ò9ó 6ð9ñ Ð2×8Ò8Ó:Ó;€	ÙÐ6×<Ò<Ó>Ó?€
Ù��V�Ó€	óò4ðsÝ%ð €IØ€Eñ ‘T˜i¨3×+@Ò+@ÔMÀIÕMð *˜9Ÿ>š>Ó+Ðð  Ñõ 	5Ù&›=ÐØ Ðñ ˜%›Ðá
ð
 #Ðð	Ù�7˜DÔ!ó+	ð^ #Ðó	ñ  ˆ
ð ô 	ò<,ð 	×Ò€à€òð,Ø€B‡J‚Jˆq„MØ€Kó=ñB Ø
ˆ&×
Ò
Ó
�Cð ˆ&�-Š-™›	Ó
"€Cò
&ò*)ð: D€
á ¨uØ!RôTà zò *óTð*ð2
€ò>ð

€ò>ò>ó
AøðK% ò %å$ß$Ð$ð%ûð& ò @Øˆ
Ø%?Ó"ð@ûð ò àƒIðûðj
 ò 	Úð	ûðD ò 	(à"'Òð	ñ ûð_ ò Ø€FØ€IØÐØÐØÐôðûðz ò Ø‚Kðús}   œN' Á)N? Á=O Æ=O Ê*O8 Ì	O) Ì4P Î'N<Î;N<Î?	OÏOÏOÏOÏO&Ï%O&Ï)O5Ï2O5Ï8PÐPÐPÐP