Ë
    hjp  ã                   ó8  — d Z ddlmZmZmZmZ ddlZddlmZ 	 ddl	m
Z
 ddlmZmZ ddlZ ej"                  e«      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 dd	lmZmZmZ dd
l m!Z! g d¢Z" e#ddddd¬«      Z$d„ Z%d„ Z&d(d„Z'e(e)fZ*e+e,fZ- e+«       Z.d)d„Z/ G d„ de0«      Z1 e#dddd¬«      Z2 G d„ de1«      Z3d*d„Z4d „ Z5 G d!„ d"e
«      Z6 e6«       Z7d#jq                  «       D ]  Z9e7ju                  e9d$e9z  «       Œ  G d%„ d&e1«      Z;d*d'„Z<y# e$ r	 ddlm
Z
 Y Œøw xY w)+z*passlib.pwd -- password generation helpersé    )Úabsolute_importÚdivisionÚprint_functionÚunicode_literalsN)Údefaultdict)ÚMutableMapping)ÚceilÚlog)Úexc)ÚPY2ÚirangeÚ
itervaluesÚ	int_types)ÚrngÚ
getrandstrÚ
to_unicode)Úmemoized_property)ÚgenwordÚdefault_charsetsÚ	genphraseÚdefault_wordsetsé   é   é$   é0   é<   )ÚunsafeÚweakÚfairÚstrongÚsecurec                 óZ   — t        | «      j                  }||j                  |«      dz   d S )z2return remaining classes in object's MRO after clsé   N)ÚtypeÚ__mro__Úindex)ÚobjÚclsÚmros      úT/var/www/html/sergio/sergio-backend/venv/lib/python3.12/site-packages/passlib/pwd.pyÚ_superclassesr+   8   s,   € ä
ˆs‹)×
Ñ
€CØˆs�y‰y˜‹~˜aÑÐ Ð!Ð!ó    c                 ó  — 	 t        | «      }t        t        «      }| D ]  }||xx   dz  cc<   Œ |€|j	                  «       }t        |«      }nt        |«      }|syt        |d«      t        d„ |D «       «      |z  z
  S # t        $ r d}Y Œ~w xY w)a÷  
    returns 'rate of self-information' --
    i.e. average (per-symbol) entropy of the sequence **source**,
    where probability of a given symbol occurring is calculated based on
    the number of occurrences within the sequence itself.

    if all elements of the source are unique, this should equal ``log(len(source), 2)``.

    :arg source:
        iterable containing 0+ symbols
        (e.g. list of strings or ints, string of characters, etc).

    :returns:
        float bits of entropy
    Nr#   r   é   c              3   ó:   K  — | ]  }|t        |d «      z  –— Œ y­w)r.   N)Úlogf)Ú.0Úvalues     r*   Ú	<genexpr>z"_self_info_rate.<locals>.<genexpr>_   s   è ø€ ÐJÁ6¸%˜u¤t¨E°1£~Õ5Á6ùs   ‚)ÚlenÚ	TypeErrorr   ÚintÚvaluesÚsumr   r0   )ÚsourceÚsizeÚcountsÚcharr7   s        r*   Ú_self_info_rater=   >   s–   € ð Ü�6‹{ˆô œÓ€FÛˆØˆt‹˜ÑŒð à€|Ø—‘“ˆÜ�6‹{‰ä˜FÓ#ˆÙØô ��a‹=œ3ÑJÁ6ÓJÓJÈTÑQÑQÐQøô ò àŠðús   ‚A> Á>BÂBc                 ó  — |r$ t        j                  |«      t        | «      «      S t        j                  j                  | «      rt        | d«      S | j                  d«      \  }}}|st        d| ›�«      ‚t        j                  ||«      S )a  
    :param asset_path:
        string containing absolute path to file,
        or package-relative path using format
        ``"python.module:relative/file/path"``.

    :returns:
        filehandle opened in 'rb' mode
        (unless encoding explicitly specified)
    ÚrbÚ:zIasset path must be absolute file path or use 'pkg.name:sub/path' format: )ÚcodecsÚ	getreaderÚ_open_asset_pathÚosÚpathÚisabsÚopenÚ	partitionÚ
ValueErrorÚpkg_resourcesÚresource_stream)rE   ÚencodingÚpackageÚsepÚsubpaths        r*   rC   rC   j   s…   € ñ Ø)Œv×Ñ Ó)Ô*:¸4Ó*@ÓAÐAÜ	‡w�w‡}�}�TÔÜ�D˜$ÓÐØ ŸN™N¨3Ó/Ñ€GˆS�'ÙÝÙDHðKó Lð 	Lä×(Ñ(¨°'Ó:Ð:r,   c                 ó&  — t         }d}	 | |v ry	 t        | t        «      s t	        t        | «      «      t	        | «      k(  r|r	 |j                  | «       yyt        «       }t        «       }| D ]  }||v r|n|j                  |«       Œ t        |«      }d}t	        |«      |kD  rd}dj                  d„ |d| D «       «      }t	        |«      |kD  r|dt	        |«      |z
  z  z  }t        d	|›d
|›�«      ‚# t        $ r d}Y Œðw xY w# t        $ r Y yw xY w)z¯
    helper for generators --
    Throws ValueError if source elements aren't unique.
    Error message will display (abbreviated) repr of the duplicates in a string/list
    TFé   é   ú, c              3   óD   K  — | ]  }t        t        |«      «      –— Œ y ­w©N)ÚreprÚstr©r1   Úwords     r*   r3   z!_ensure_unique.<locals>.<genexpr>«   s   è ø€ ÐB±\¨Tœœc $›iŸ±\ùs   ‚ Nz, ... plus %d othersÚ`z%` cannot contain duplicate elements: )
Ú_ensure_unique_cacher5   Ú
isinstanceÚ
_set_typesr4   ÚsetÚaddÚsortedÚjoinrI   )	r9   ÚparamÚcacheÚhashableÚseenÚdupsÚelemÚtruncÚdup_reprs	            r*   Ú_ensure_uniquerj   ˆ   s0  € ô !€EØ€HðØ�U‰?Øð ô �&œ*Ô%¬¬S°«[Ó)9¼SÀ»[Ò)HÙðØ—	‘	˜&Ô!ñ
 ô ‹5€DÜ‹5€DÛˆØ˜‘‰ 4×,Ñ,¨TÕ2ð ä�$‹<€DØ€EÜ
ˆ4ƒy�5ÒØˆØ�y‰yÑB°T¸&¸5±\ÓBÓB€HÜ
ˆ4ƒy�5ÒØÐ*¬c°$«i¸%Ñ.?Ñ@Ñ@ˆõ Ú™Xð'ó (ð (øô9 ò ØŠðûô ò ð Øð	ús#   ŠC3 ÁD Ã3DÄ DÄ	DÄDc                   óz   ‡ — e Zd ZdZdZdZeZdZdˆ fd„	Ze	d„ «       Z
e	d„ «       Zd„ Zdd„Zd	„ Zerd
„ Zˆ xZS ˆ xZS )ÚSequenceGeneratoraY  
    Base class used by word & phrase generators.

    These objects take a series of options, corresponding
    to those of the :func:`generate` function.
    They act as callables which can be used to generate a password
    or a list of 1+ passwords. They also expose some read-only
    informational attributes.

    Parameters
    ----------
    :param entropy:
        Optionally specify the amount of entropy the resulting passwords
        should contain (as measured with respect to the generator itself).
        This will be used to auto-calculate the required password size.

    :param length:
        Optionally specify the length of password to generate,
        measured as count of whatever symbols the subclass uses (characters or words).
        Note if ``entropy`` requires a larger minimum length,
        that will be used instead.

    :param rng:
        Optionally provide a custom RNG source to use.
        Should be an instance of :class:`random.Random`,
        defaults to :class:`random.SystemRandom`.

    Attributes
    ----------
    .. autoattribute:: length
    .. autoattribute:: symbol_count
    .. autoattribute:: entropy_per_symbol
    .. autoattribute:: entropy

    Subclassing
    -----------
    Subclasses must implement the ``.__next__()`` method,
    and set ``.symbol_count`` before calling base ``__init__`` method.
    Nr    c                 óî  •— | j                   €J d«       ‚|€|€^|€| j                  }t        j                  ||«      }|dk  rt	        d«      ‚t        t        || j                  z  «      «      }|�||k  r|}|| _        |dk  rt	        d«      ‚|| _        |�|| _	        |rCt        | t        «      t        fk(  r+t        ddj                  |j                  «       «      z  «      ‚t!        t        | �F  di |¤Ž y )	Nzsubclass must set .symbol_countr   z!`entropy` must be positive numberr#   z!`length` must be positive integerzUnexpected keyword(s): %srS   © )Úsymbol_countÚrequested_entropyÚentropy_aliasesÚgetrI   r6   r	   Úentropy_per_symbolÚlengthr   r+   rl   Úobjectr5   ra   ÚkeysÚsuperÚ__init__)ÚselfÚentropyrt   r   ÚkwdsÚ
min_lengthÚ	__class__s         €r*   rx   zSequenceGenerator.__init__ñ   s  ø€ ð × Ñ Ð,ÐOÐ.OÓOÐ,ð Ð & .ØˆØ×0Ñ0�Ü%×)Ñ)¨'°7Ó;ˆGØ˜!Š|Ü Ð!DÓEÐEÜœT '¨D×,CÑ,CÑ"CÓDÓEˆJØˆ~ ¨*Ò!4Ø#�à!(ˆÔà�AŠ:ÜÐ@ÓAÐAØˆŒð ˆ?ØˆDŒHñ ”M $Ô(9Ó:¼v¸iÒGÜÐ7¸$¿)¹)ÀDÇIÁIÃKÓ:PÑPÓQÐQÜÔ Ñ/Ñ7°$Ó7r,   c                 ó.   — t        | j                  d«      S )zZ
        Average entropy per symbol (assuming all symbols have equal probability)
        r.   )r0   ro   ©ry   s    r*   rs   z$SequenceGenerator.entropy_per_symbol  s   € ô
 �D×%Ñ% qÓ)Ð)r,   c                 ó4   — | j                   | j                  z  S )a+  
        Effective entropy of generated passwords.

        This value will always be a multiple of :attr:`entropy_per_symbol`.
        If entropy is specified in constructor, :attr:`length` will be chosen so
        so that this value is the smallest multiple >= :attr:`requested_entropy`.
        )rt   rs   r   s    r*   rz   zSequenceGenerator.entropy  s   € ð �{‰{˜T×4Ñ4Ñ4Ð4r,   c                 ó   — t        d«      ‚)z;main generation function, should create one password/phrasezimplement in subclass)ÚNotImplementedErrorr   s    r*   Ú__next__zSequenceGenerator.__next__)  s   € ä!Ð"9Ó:Ð:r,   c                 óÌ   — |€t        | «      S t        |t        «      r"t        |«      D �cg c]  }t        | «      ‘Œ c}S |t        u r| S t        j                  |dd«      ‚c c}w )zN
        frontend used by genword() / genphrase() to create passwords
        z<None>, int, or <iter>Úreturns)Únextr\   r   r   Úiterr   ÚExpectedTypeError)ry   r…   Ú_s      r*   Ú__call__zSequenceGenerator.__call__-  sa   € ð ˆ?Ü˜“:ÐÜ˜¤Ô+Ü(.¨w¬Ó8© 1”D˜•J¨Ñ8Ð8Øœ‰_ØˆKä×'Ñ'¨Ð1IÈ9ÓUÐUùò	 9s   «A!c                 ó   — | S rU   rn   r   s    r*   Ú__iter__zSequenceGenerator.__iter__:  s   € Øˆr,   c                 ó"   — | j                  «       S rU   )rƒ   r   s    r*   r†   zSequenceGenerator.next>  s   € Ø—=‘=“?Ð"r,   ©NNNrU   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__rt   rp   r   ro   rx   r   rs   rz   rƒ   rŠ   rŒ   r   r†   Ú__classcell__©r}   s   @r*   rl   rl   ¶   ss   ø„ ñ&ðX €Fð !Ðð €Cð €Lõ
8ðF ñ*ó ð*ð ñ5ó ð5ò;óVòñ ö	#ó r,   rl   zH0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*?/Ú>0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZÚ2234679abcdefghjkmnpqrstuvwxyzACDEFGHJKMNPQRTUVWXYZÚ0123456789abcdef)Úascii_72Úascii_62Úascii_50Úhexc                   óB   ‡ — e Zd ZdZdZdZdˆ fd„	Zed„ «       Zd„ Z	ˆ xZ
S )ÚWordGeneratoraê  
    Class which generates passwords by randomly choosing from a string of unique characters.

    Parameters
    ----------
    :param chars:
        custom character string to draw from.

    :param charset:
        predefined charset to draw from.

    :param \*\*kwds:
        all other keywords passed to the :class:`SequenceGenerator` parent class.

    Attributes
    ----------
    .. autoattribute:: chars
    .. autoattribute:: charset
    .. autoattribute:: default_charsets
    r™   Nc                 óÐ   •— |r|r&t        d«      ‚|s| j                  }|sJ ‚t        |   }|| _        t        |d¬«      }t	        |d¬«       || _        t        t        | �"  di |¤Ž y )Nz,`chars` and `charset` are mutually exclusiveÚchars©rb   rn   )	r5   Úcharsetr   r   rj   rŸ   rw   r�   rx   )ry   rŸ   r¡   r{   r}   s       €r*   rx   zWordGenerator.__init__~  sl   ø€ ñ ÙÜÐ NÓOÐOáØŸ,™,�Ù��wÜ$ WÑ-ˆEØˆŒÜ˜5¨Ô0ˆÜ�u GÕ,ØˆŒ
ô 	Œm˜TÑ+Ñ3¨dÓ3r,   c                 ó,   — t        | j                  «      S rU   )r4   rŸ   r   s    r*   ro   zWordGenerator.symbol_count–  ó   € ä�4—:‘:‹Ðr,   c                 óX   — t        | j                  | j                  | j                  «      S rU   )r   r   rŸ   rt   r   s    r*   rƒ   zWordGenerator.__next__ž  s   € ô ˜$Ÿ(™( D§J¡J°·±Ó<Ð<r,   )NN)r�   r�   r‘   r’   r¡   rŸ   rx   r   ro   rƒ   r“   r”   s   @r*   r�   r�   \  s4   ø„ ñð2 €Gð €Eõ
4ð0 ñó ðö=r,   r�   c                 ó.   — t        d|| dœ|¤Ž} ||«      S )a¶
  Generate one or more random passwords.

    This function uses :mod:`random.SystemRandom` to generate
    one or more passwords using various character sets.
    The complexity of the password can be specified
    by size, or by the desired amount of entropy.

    Usage Example::

        >>> # generate a random alphanumeric string with 48 bits of entropy (the default)
        >>> from passlib import pwd
        >>> pwd.genword()
        'DnBHvDjMK6'

        >>> # generate a random hexadecimal string with 52 bits of entropy
        >>> pwd.genword(entropy=52, charset="hex")
        '310f1a7ac793f'

    :param entropy:
        Strength of resulting password, measured in 'guessing entropy' bits.
        An appropriate **length** value will be calculated
        based on the requested entropy amount, and the size of the character set.

        This can be a positive integer, or one of the following preset
        strings: ``"weak"`` (24), ``"fair"`` (36),
        ``"strong"`` (48), and ``"secure"`` (56).

        If neither this or **length** is specified, **entropy** will default
        to ``"strong"`` (48).

    :param length:
        Size of resulting password, measured in characters.
        If omitted, the size is auto-calculated based on the **entropy** parameter.

        If both **entropy** and **length** are specified,
        the stronger value will be used.

    :param returns:
        Controls what this function returns:

        * If ``None`` (the default), this function will generate a single password.
        * If an integer, this function will return a list containing that many passwords.
        * If the ``iter`` constant, will return an iterator that yields passwords.

    :param chars:

        Optionally specify custom string of characters to use when randomly
        generating a password. This option cannot be combined with **charset**.

    :param charset:

        The predefined character set to draw from (if not specified by **chars**).
        There are currently four presets available:

        * ``"ascii_62"`` (the default) -- all digits and ascii upper & lowercase letters.
          Provides ~5.95 entropy per character.

        * ``"ascii_50"`` -- subset which excludes visually similar characters
          (``1IiLl0Oo5S8B``). Provides ~5.64 entropy per character.

        * ``"ascii_72"`` -- all digits and ascii upper & lowercase letters,
          as well as some punctuation. Provides ~6.17 entropy per character.

        * ``"hex"`` -- Lower case hexadecimal.  Providers 4 bits of entropy per character.

    :returns:
        :class:`!unicode` string containing randomly generated password;
        or list of 1+ passwords if :samp:`returns={int}` is specified.
    )rt   rz   rn   )r�   ©rz   rt   r…   r{   Úgens        r*   r   r   ¨  s#   € ôL Ð
?˜v¨wÑ
?¸$Ñ
?€CÙˆw‹<Ðr,   c                 ó¾   — t        | d«      5 }d„ |D «       }t        d„ |D «       «      }ddd«       t        j                  dt	        «      | «       |S # 1 sw Y   Œ+xY w)a2  
    load wordset from compressed datafile within package data.
    file should be utf-8 encoded

    :param asset_path:
        string containing  absolute path to wordset file,
        or "python.module:relative/file/path".

    :returns:
        tuple of words, as loaded from specified words file.
    zutf-8c              3   ó<   K  — | ]  }|j                  «       –— Œ y ­wrU   )ÚstriprX   s     r*   r3   z _load_wordset.<locals>.<genexpr>  s   è ø€ Ð+© ˆt�z‰z�|©ùs   ‚c              3   ó&   K  — | ]	  }|sŒ|–— Œ y ­wrU   rn   rX   s     r*   r3   z _load_wordset.<locals>.<genexpr>  s   è ø€ Ð3¡s˜tªd”d¡sùs   ‚ŠNz!loaded %d-element wordset from %r)rC   Útupler
   Údebugr4   )Ú
asset_pathÚfhr§   Úwordss       r*   Ú_load_wordsetr±   õ  sT   € ô 
˜* gÔ	.°"Ù+©Ó+ˆÜÑ3¡sÓ3Ó3ˆ÷ 
/ô$ ‡I�IÐ1´3°u³:¸zÔJØ€L÷' 
/Ð	.ús   �AÁAc                   ód   ‡ — e Zd ZdZdZdZˆ fd„Zd„ Zd„ Zd„ Z	d„ Z
ed„ «       Zd	„ Zd
„ Zd„ Zˆ xZS )ÚWordsetDictz¢
    Special mapping used to store dictionary of wordsets.
    Different from a regular dict in that some wordsets
    may be lazy-loaded from an asset path.
    Nc                 óH   •— i | _         i | _        t        t        | �  |i |¤Ž y rU   )ÚpathsÚ_loadedrw   r³   rx   )ry   Úargsr{   r}   s      €r*   rx   zWordsetDict.__init__%  s%   ø€ ØˆŒ
ØˆŒÜŒk˜4Ñ)¨4Ð8°4Ó8r,   c                 ó–   — 	 | j                   |   S # t        $ r Y nw xY w| j                  |   }t        |«      x}| j                   |<   |S rU   )r¶   ÚKeyErrorrµ   r±   )ry   ÚkeyrE   r2   s       r*   Ú__getitem__zWordsetDict.__getitem__*  sR   € ð	Ø—<‘< Ñ$Ð$øÜò 	Ùð	úà�z‰z˜#‰ˆÜ$1°$Ó$7Ð7ˆ�—‘˜SÑ!Øˆs   ‚ ‘	œc                 ó"   — || j                   |<   y)z;
        set asset path to lazy-load wordset from.
        N)rµ   )ry   rº   rE   s      r*   Úset_pathzWordsetDict.set_path3  s   € ð ˆ�
‰
�3Šr,   c                 ó"   — || j                   |<   y rU   )r¶   )ry   rº   r2   s      r*   Ú__setitem__zWordsetDict.__setitem__9  s   € Ø!ˆ�‰�SÒr,   c                 óz   — || v r*| j                   |= | j                  j                  |d «       y | j                  |= y rU   )r¶   rµ   Úpop©ry   rº   s     r*   Ú__delitem__zWordsetDict.__delitem__<  s2   € Ø�$‰;Ø—‘˜SÐ!Ø�J‰J�N‰N˜3 Õ%à—
‘
˜3‘r,   c                 óf   — t        | j                  «      }|j                  | j                  «       |S rU   )r^   r¶   Úupdaterµ   )ry   rv   s     r*   Ú_keysetzWordsetDict._keysetC  s%   € ä�4—<‘<Ó ˆØ�‰�D—J‘JÔØˆr,   c                 ó,   — t        | j                  «      S rU   )r‡   rÆ   r   s    r*   rŒ   zWordsetDict.__iter__I  s   € Ü�D—L‘LÓ!Ð!r,   c                 ó,   — t        | j                  «      S rU   )r4   rÆ   r   s    r*   Ú__len__zWordsetDict.__len__L  s   € Ü�4—<‘<Ó Ð r,   c                 ó>   — || j                   v xs || j                  v S rU   )r¶   rµ   rÂ   s     r*   Ú__contains__zWordsetDict.__contains__P  s   € Ø�d—l‘lÐ"Ò7 c¨T¯Z©ZÐ&7Ð7r,   )r�   r�   r‘   r’   rµ   r¶   rx   r»   r½   r¿   rÃ   ÚpropertyrÆ   rŒ   rÉ   rË   r“   r”   s   @r*   r³   r³     sR   ø„ ñð €Eð €Gô9ò
òò"ò ð ñó ðò
"ò!ö8r,   r³   z%eff_long eff_short eff_prefixed bip39zpasslib:_data/wordsets/%s.txtc                   óF   ‡ — e Zd ZdZdZdZdZdˆ fd„	Zed„ «       Z	d„ Z
ˆ xZS )	ÚPhraseGeneratoraÌ  class which generates passphrases by randomly choosing
    from a list of unique words.

    :param wordset:
        wordset to draw from.
    :param preset:
        name of preset wordlist to use instead of ``wordset``.
    :param spaces:
        whether to insert spaces between words in output (defaults to ``True``).
    :param \*\*kwds:
        all other keywords passed to the :class:`SequenceGenerator` parent class.

    .. autoattribute:: wordset
    Úeff_longNÚ c                 ó0  •— |�|�&t        d«      ‚|€| j                  }|sJ ‚t        |   }|| _        t        |t        «      st        |«      }t        |d¬«       || _        |€| j                  }t        |d¬«      }|| _        t        t        | �2  di |¤Ž y )Nz,`words` and `wordset` are mutually exclusiver°   r    rN   rn   )r5   Úwordsetr   r\   Ú_sequence_typesr¬   rj   r°   rN   r   rw   rÎ   rx   )ry   rÒ   r°   rN   r{   r}   s        €r*   rx   zPhraseGenerator.__init__~  s    ø€ ð ÐØÐ"ÜÐ NÓOÐOàˆØŸ,™,�Ù��wÜ$ WÑ-ˆEØˆŒô ˜%¤Ô1Ü˜%“LˆEÜ�u GÕ,ØˆŒ
ð ˆ;Ø—(‘(ˆCÜ˜ EÔ*ˆØˆŒô 	Œo˜tÑ-Ñ5°Ó5r,   c                 ó,   — t        | j                  «      S rU   )r4   r°   r   s    r*   ro   zPhraseGenerator.symbol_count   r£   r,   c                 óv   ‡ — ˆ fd„t        ‰ j                  «      D «       }‰ j                  j                  |«      S )Nc              3   óh   •K  — | ])  }‰j                   j                  ‰j                  «      –— Œ+ y ­wrU   )r   Úchoicer°   )r1   r‰   ry   s     €r*   r3   z+PhraseGenerator.__next__.<locals>.<genexpr>©  s%   øè ø€ ÐJÑ6I°�—‘—‘ §¡×,Ñ6Iùs   ƒ/2)r   rt   rN   ra   )ry   r°   s   ` r*   rƒ   zPhraseGenerator.__next__¨  s)   ø€ ÛJ´f¸T¿[¹[Ô6IÓJˆØ�x‰x�}‰}˜UÓ#Ð#r,   rŽ   )r�   r�   r‘   r’   rÒ   r°   rN   rx   r   ro   rƒ   r“   r”   s   @r*   rÎ   rÎ   _  s<   ø„ ñð& €Gð €Eð €Cõ
6ðD ñó ðö$r,   rÎ   c                 ó.   — t        d| |dœ|¤Ž} ||«      S )am  Generate one or more random password / passphrases.

    This function uses :mod:`random.SystemRandom` to generate
    one or more passwords; it can be configured to generate
    alphanumeric passwords, or full english phrases.
    The complexity of the password can be specified
    by size, or by the desired amount of entropy.

    Usage Example::

        >>> # generate random phrase with 48 bits of entropy
        >>> from passlib import pwd
        >>> pwd.genphrase()
        'gangly robbing salt shove'

        >>> # generate a random phrase with 52 bits of entropy
        >>> # using a particular wordset
        >>> pwd.genword(entropy=52, wordset="bip39")
        'wheat dilemma reward rescue diary'

    :param entropy:
        Strength of resulting password, measured in 'guessing entropy' bits.
        An appropriate **length** value will be calculated
        based on the requested entropy amount, and the size of the word set.

        This can be a positive integer, or one of the following preset
        strings: ``"weak"`` (24), ``"fair"`` (36),
        ``"strong"`` (48), and ``"secure"`` (56).

        If neither this or **length** is specified, **entropy** will default
        to ``"strong"`` (48).

    :param length:
        Length of resulting password, measured in words.
        If omitted, the size is auto-calculated based on the **entropy** parameter.

        If both **entropy** and **length** are specified,
        the stronger value will be used.

    :param returns:
        Controls what this function returns:

        * If ``None`` (the default), this function will generate a single password.
        * If an integer, this function will return a list containing that many passwords.
        * If the ``iter`` builtin, will return an iterator that yields passwords.

    :param words:

        Optionally specifies a list/set of words to use when randomly generating a passphrase.
        This option cannot be combined with **wordset**.

    :param wordset:

        The predefined word set to draw from (if not specified by **words**).
        There are currently four presets available:

        ``"eff_long"`` (the default)

            Wordset containing 7776 english words of ~7 letters.
            Constructed by the EFF, it offers ~12.9 bits of entropy per word.

            This wordset (and the other ``"eff_"`` wordsets)
            were `created by the EFF <https://www.eff.org/deeplinks/2016/07/new-wordlists-random-passphrases>`_
            to aid in generating passwords.  See their announcement page
            for more details about the design & properties of these wordsets.

        ``"eff_short"``

            Wordset containing 1296 english words of ~4.5 letters.
            Constructed by the EFF, it offers ~10.3 bits of entropy per word.

        ``"eff_prefixed"``

            Wordset containing 1296 english words of ~8 letters,
            selected so that they each have a unique 3-character prefix.
            Constructed by the EFF, it offers ~10.3 bits of entropy per word.

        ``"bip39"``

            Wordset of 2048 english words of ~5 letters,
            selected so that they each have a unique 4-character prefix.
            Published as part of Bitcoin's `BIP 39 <https://github.com/bitcoin/bips/blob/master/bip-0039/english.txt>`_,
            this wordset has exactly 11 bits of entropy per word.

            This list offers words that are typically shorter than ``"eff_long"``
            (at the cost of slightly less entropy); and much shorter than
            ``"eff_prefixed"`` (at the cost of a longer unique prefix).

    :param sep:
        Optional separator to use when joining words.
        Defaults to ``" "`` (a space), but can be an empty string, a hyphen, etc.

    :returns:
        :class:`!unicode` string containing randomly generated passphrase;
        or list of 1+ passphrases if :samp:`returns={int}` is specified.
    )rz   rt   rn   )rÎ   r¦   s        r*   r   r   ±  s#   € ôB Ð
A '°&Ñ
A¸DÑ
A€CÙˆw‹<Ðr,   rU   )r9   rŽ   )=r’   Ú
__future__r   r   r   r   rA   Úcollectionsr   Úcollections.abcr   ÚImportErrorÚmathr	   r
   r0   ÚloggingÚ	getLoggerr�   rJ   rD   Úpasslibr   Úpasslib.utils.compatr   r   r   r   Úpasslib.utilsr   r   r   Úpasslib.utils.decorr   Ú__all__Údictrq   r+   r=   rC   Úlistr¬   rÓ   r^   Ú	frozensetr]   r[   rj   ru   rl   r   r�   r   r±   r³   r   ÚsplitÚnamer½   rÎ   r   rn   r,   r*   Ú<module>rê      sm  ðÙ 0÷ SÓ Rã Ý #ð+Ý.÷ #Û Ð'�g×'Ñ'¨Ó1�Û Û 	õ ß CÓ Cß 5Ñ 5Ý 1ò€ñ àð 
ð 
ð ð ô€ò*"ò!RóX;ð. ˜�-€Ø�9Ð€
ñ “uÐ ó)(ô\I#˜ô I#ñh àWð Nð Bð 	ôÐ ô$E=Ð%ô E=óXGòZ ôF98�.ô 98ñ| “=Ð ð 4×9Ñ9Ö;€DØ×Ñ˜dÐ$CÀdÑ$JÕKð <ôK$Ð'ô K$ôdbøðM ò +ç*ð+ús   šD ÄDÄD