%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__/oracle.cpython-39.pyc

a

f�Wc#�@s�dZddlmZmZddlmZddlZddlZe�e	�Z
ddlmZm
Z
ddlmZmZmZmZmZddlmZddlmmZdd	gZddd
�ZdZGdd�dejej�ZGdd�dej ej!�Z"dS)z3passlib.handlers.oracle - Oracle DB Password Hashes�)�hexlify�	unhexlify)�sha1N)�
to_unicode�	xor_bytes)�irange�u�
uascii_to_str�unicode�
str_to_uascii)�des_encrypt_blockZ	oracle10gZ	oracle11g��cCsT||t|�d7}|}tdt|�d�D]$}t||||d��}t||�}q*|S)a�performs des-cbc encryption, returns only last block.

    this performs a specific DES-CBC encryption implementation
    as needed by the Oracle10 hash. it probably won't be useful for
    other purposes as-is.

    input value is null-padded to multiple of 8 bytes.

    :arg key: des key as bytes
    :arg value: value to encrypt, as bytes.
    :param iv: optional IV
    :param pad: optional pad byte

    :returns: last block of DES-CBC encryption of all ``value``'s byte blocks.
    �r)�lenrrr)�key�valueZivZpad�hash�offset�chunk�r�;/usr/lib/python3.9/site-packages/passlib/handlers/oracle.py�des_cbc_encryptsrs#Eg����c@s2eZdZdZdZejZdZe	dd��Z
dd�ZdS)�oracle10a�This class implements the password hash used by Oracle up to version 10g, and follows the :ref:`password-hash-api`.

    It does a single round of hashing, and relies on the username as the salt.

    The :meth:`~passlib.ifc.PasswordHash.hash`, :meth:`~passlib.ifc.PasswordHash.genhash`, and :meth:`~passlib.ifc.PasswordHash.verify` methods all require the
    following additional contextual keywords:

    :type user: str
    :param user: name of oracle user account this password is associated with.
    �cCs|��S)N)�upper)�clsrrrr�
_norm_hashIszoracle10._norm_hashcCs\t|t�r|�d�}t|jddd�}||���d�}tt|�}t||�}t	|��d���S)N�utf-8�user)Zparamz	utf-16-be�ascii)
�
isinstance�bytes�decoderrr�encoder�ORACLE10_MAGICr)�self�secretr�inputrrrr�_calc_checksumMs



zoracle10._calc_checksumN)�__name__�
__module__�__qualname__�__doc__�name�uhZ	HEX_CHARS�checksum_chars�
checksum_size�classmethodrr)rrrrr4s

rc@s^eZdZdZdZdZdZejZ	dZ
ZejZe
�ed�e
j�Zedd��Zdd	�Zd
d�ZdS)
�oracle11aEThis class implements the Oracle11g password hash, and follows the :ref:`password-hash-api`.

    It supports a fixed-length salt.

    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 20 hexadecimal characters.

    :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
        ``salt`` strings that are too long.

        .. versionadded:: 1.6
    )�salt�(�z/^S:(?P<chk>[0-9a-f]{40})(?P<salt>[0-9a-f]{20})$cCsHt|dd�}|j�|�}|s(tj�|��|�dd�\}}|||��d�S)Nr rr4�chk)r4�checksum)r�_hash_regex�matchr/�excZInvalidHashError�groupr)rr�mr4r7rrr�from_string�szoracle11.from_stringcCs(|j}td�|��|j��f}t|�S)NzS:%s%s)r8rrr4r	)r&r7rrrr�	to_string�szoracle11.to_stringcCs<t|t�r|�d�}t|t|j�d�����}t|���S)Nrr )	r!r
r$rrr4�	hexdigestrr)r&r'r7rrrr)�s

zoracle11._calc_checksumN)r*r+r,r-r.Zsetting_kwdsr1r/ZUPPER_HEX_CHARSr0Z
min_salt_sizeZ
max_salt_sizeZ
salt_chars�re�compiler�Ir9r2r>r?r)rrrrr3hs
r3)r
r)#r-ZbinasciirrZhashlibrrAZloggingZ	getLoggerr*�logZ
passlib.utilsrrZpasslib.utils.compatrrr	r
rZpasslib.crypto.desrZpasslib.utils.handlersZutils�handlersr/�__all__rr%ZHasUserContextZ
StaticHandlerrZHasSaltZGenericHandlerr3rrrr�<module>s�
4

Zerion Mini Shell 1.0