403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /lib/python3.9/site-packages/passlib/crypto/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /lib/python3.9/site-packages/passlib/crypto/__pycache__/des.cpython-39.pyc
a

f�Wc���@s�dZddlZddlmZddlmZmZmZmZmZddgZ	dZ
dZd	Zd
Z
dZdZdaaaad
d�Zdd�Ze�d�Zdd�Zdd�Zdd�Zdd�Zeddd�Zdd�Zdd�Zd#d d�Zd$d!d"�Z dS)%a�passlib.crypto.des -- DES block encryption routines

History
=======
These routines (which have since been drastically modified for python)
are based on a Java implementation of the des-crypt algorithm,
found at `<http://www.dynamic.net.au/christos/crypt/UnixCrypt2.txt>`_.

The copyright & license for that source is as follows::

    UnixCrypt.java 0.9 96/11/25
    Copyright (c) 1996 Aki Yoshida. All rights reserved.
    Permission to use, copy, modify and distribute this software
    for non-commercial or commercial purposes and without fee is
    hereby granted provided that this copyright notice appears in
    all copies.

    ---

    Unix crypt(3C) utility
    @version 0.9, 11/25/96
    @author  Aki Yoshida

    ---

    modified April 2001
    by Iris Van den Broeke, Daniel Deville

    ---
    Unix Crypt.
    Implements the one way cryptography used by Unix systems for
    simple password protection.
    @version $Id: UnixCrypt2.txt,v 1.1.1.1 2005/09/13 22:20:13 christos Exp $
    @author Greg Wilkins (gregw)

The netbsd des-crypt implementation has some nice notes on how this all works -
    http://fxr.googlebit.com/source/lib/libcrypt/crypt.c?v=NETBSD-CURRENT
�N)�exc)�join_byte_values�byte_elem_value�iranger�	int_types�expand_des_key�des_encrypt_blocki���l����l����l�~�}�{�wll���s�gc	CsPd}d}d}||f||f||f||f||f||f||f||ffadadadadS)z3delay loading tables until they are actually needed))rr� r	� r
�  r�r�$r
� r� $r)r��l�l�l�@l@l@l@lDlDlDlD)rr�@r� r�@ r� r�@ r�  r�@  r)r��@l@�llHlH�ll@l@lllHlH)rr�r �r!�r"�r#�r$�r%�r&)r��l�lll�lll�lll)rr�r,�r-�r.�@r/�Pr0�@r1�Pr2)r�@� l@ ��@l l@ � �@ l  l@  � l@ l  l@  )rr�r:�r;�r<��r=��r>��r?��r@)r���l��@l@l�@l�@�l��l�l@l@l�@l�@)rr�@rF�rG�@rH�rI�@rJ�rK�@rL)r���l�l�l�lllllll)rr�@rR�rS�@rT�rU�@rV�rW�@rX)r��l� l l l �llll!l!l!l!)rr�r]�r^�r_�r`� ra� rb� rc)r��l��l�l�l�� l"l l"� �l"�l �l"�))rrrrrrrrrGrGrGrG� ririri)rrIr]lr	i(l l(r,�l l i i(l  l( )rrrrr^r^r^r^r=r=r=r=�rkrkrk)rr!rdlrFl�l�l�rAllli@l�l�l�)rrrrrrrrr-r-r-r-�@rlrlrl)rrUrir:�i�i�r/i@i@i@i�@i�@i�@i�@)rrrrr;r;r;r;r`r`r`r`�rnrnrn)rr r
i r#r$�$i$rYll l lll$l$)rrSrM��rfl�l�l�r\llll�l�l�l�)rr'r4l rCl@l`l`r�l l l@l@l`l`)rrRri@ rZl@l@l@@r(l@l@l@@ll@l@l@@)rr5r7r9r�l0l0rgl l  l  l l l 0l 0)rrNrlr*l�lr3l@�@l@l@l@l@l@)rr[rQ� rBl� l�l� rl(ll(l�l�(l�l�()rrrl@rO�l@l@rrl@l@lll@l@)rr)relrl@l@l@rDllllAlAlAlA))rrrrrrrrr;r;r;r;�rwrwrw)rr=rRi@�rd�l@l@r i�i@i@�lll@l@)rrrrrSrSrSrSr/r/r/r/�@ryryry)rrrYl@r:i� l�l�@r`i l l @i�i� l� l� @)rrrrr	r	r	r	r!r!r!r!� rzrzrz)rrIr^lr,rjl l r#illiil l )rrrrr-r-r-r-rUrUrUrU�r{r{r{)rrr]l@rrl@l@@rMi@�ll@i� i@� lAl@A)rrGrAir[l l l rQlllrul l l )rrr(�r5rrllrlPl@lPl@lPl@lP)rrFr
i @rNl�l l �rl�@l @l �@lBl�Bl Bl �B)rr)r*r+rlrslr\lll�lll)rrBrel�rl�ll�r'l�ll�rql�ll�)rrOrDlr4l!l l!rrvlll l!l l!)rrgrl0rCl @l@l0@rfrhl�l0��@�l @�l@�l0@�)rrrZ�r3l@l@l@r7l l(l(r8l@ l@(l@())r��rpi���lll�lllllll)r� � l  ��@l� Dl� @l�  D�@l @l Dl  Dl�@@l� @Dl� D@l�  DD)rr-rUr{r,r.��r`�������)rrCr3�@@r5�@r6�@@rfr~�@��@@����@��@��@@�)rr	r
rr�  �  �   r�  �  �   r�   �   �    )rrDrBrEr�����r\�����r}�����)r�@�@ lD@ �@i@@l@ lD@ �@iD@l@� lDD� iD@iDD@l@� lDD� )r��l� l"l l"�llll l"l l"))@�@"r�r�� @"r� "� r�r�r��@�  � @ rrr�r�r
�@ �"r�r�r�r�r
r�r�� @r�r�r�rrr�r�r�r�r�r�r�r�r�r�r�r�r
r�r�r�r�r�r�rr�r�rr�rr�r�r
r�r�r�)@�@  r�  �@�@� �@ r�r��@ r5r�� �@  r�r5r,�@ r�r��  r�rr�r�r�r�r�r�r,r�r�r�r�r�r�r�r�r�rr�r�r,r�r�r�r�r�r�r�rr�r5r�r�r�r�r,r�r�r�r5r�r�)@�@���rf����r�r������r���rU�����rU��rr�r�rfr�r�r�r�r�r���r�r�rr�r�r�rfrUr�r�r�r�r�rr�r�r�r�r�r�rUr�r�r�r�r�r�r�r�r�rr�r�r�r�rfr�)@��@@�@r���@@r�@��@@��@�@��@r-��@@r�r�r�r-��@�@rCr�r�r�r�rCr�rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrCr�rr�r�rCr-r�r�r�r�r�r�r�r�r�r�r�r�r-r�r�)@r�r3r��@�@��@�@r3r��@�r��@rr�r�rt�r�r�rr�rr�r�rtr�r�r�r�r�r�rtr�r3rr�r�r�r�r�rr�r�r�rtr�r�rr�r�r�r�r3r�r�r�r�rr�r�r�)@� �@ r�@r�rD�!r�!�@!�@rp�r��� �@!rr��@ rrDr�r�r�r�r�rpr�r�r�r�r�r�rpr�r�r�r�rr�rprDr�rr�r�r�r�r�r�rr�r�r�r�rrDr�r�r�r�r�r�r�)@r�r\� �@  �@ !�@ �rr`�@ !�@!� r�� r�r�r�r�r�r�rr�r�r��@  �@!r�r�r�r�r\r`r�r�r�r�r�r\r`r�r�r�r�rr\r�r�r�rr�r�r�r�r�r�r`r�r�r�r�r�r�r�r�)@� @� ���@r� ��@� � �@r�r	��r��@� �@� @rrBrrrrrrrr	r�rr�r�rBr�r�r�rBrrrr	rrr�rrrr�r�rrrr�rrrrrrr�r�rrr	r�rBr))rrBrDrEr\r�r�r�rr�r�r�r}r�r�r�)rrYr!lrlllr(lllr|lll)rr
r	rrr�r�r�rr�r�r�rr�r�r�)r�iiiiiiiiiiiiii)rr*rlr)r+llrQlllllll)rrgr4l  rl @l @l  @rl @l @l  @l@@l @@l @@l  @@)rr:rMi��r=r>i��i���rdl�ll�rxl�ll�)rrSrIir;iiirAiiiiiii)rr3rCr�rfr�r~r�r5r6r�r�r�r�r�r�)rr^r]r_rZlllrlllrlll)rrUr-r{r`r�r�r�r,r�r.r�r�r�r�r�)r��iiiiiiiiiiiii)rrOr'lrNrPllrlrqlllll)rrrelr7l l l r[l l l l  l  l  l  )rrrRi@@rFi@@i@@i@@@r/i@@i@@i@@@i@@i@@@i@@@i@@@@)rr#rir r$iirGiiiiiiiN)�PCXROT�IE3264�SPE�CF6464)ZPC1ROTZPC2ROTAZPC2ROTB�r�6/usr/lib/python3.9/site-packages/passlib/crypto/des.py�_load_tablesQs	GDQ�&	rcCs*d}|D]}|||d@O}|dL}q|S)zdReturns the permutation of the given 32-bit or 64-bit code with
    the specified permutation table.r�r#r)�c�p�out�rrrr�_permute9s

rz>QcCs
t�|�S)N��_uint64_struct�pack��valuerrr�_pack64JsrcCst�|�dS)Nr�r�unpackrrrr�	_unpack64Msr!cCst�|�dd�S)Nr
rrrrr�_pack56Psr"cCst�d|�dS)N�rrrrrr�	_unpack56Ssr$�1i����cs~t�t�r t��dkr`td��n@t�t�rR�dks:�tkrBtd��ttt����St	�
�dd��t���t�fdd�t
D��S)	zDconvert DES from 7 bytes to 8 bytes (by inserting empty parity bits)�zkey must be 7 bytes in sizerz'key must be 56-bit non-negative integer�bytes or int�keyc3s|]}�|?d@d>VqdS)�r
Nr)�.0�shift�r(rr�	<genexpr>u�z!expand_des_key.<locals>.<genexpr>)�
isinstance�bytes�len�
ValueErrorr�INT_56_MASKr!rr"r�ExpectedTypeErrorr$r�_EXPAND_ITERr,rr,rrcs


cCs�t|t�r.t|�dkrtd��ttt|���St|t�rR|dksH|tkr`td��nt	�
|dd��|dL}d}d}|dkr�||d	@|>O}|dL}|d
7}qp|t@r�J�|S)zGconvert DES key from 8 bytes to 7 bytes (by discarding the parity bits)rSzkey must be 8 bytes in sizer�'key must be 64-bit non-negative integerr'r(r
�8r)r&)r/r0r1r2r"�shrink_des_keyr!r�INT_64_MASKrr4)r(�result�offsetrrrr8ws"



r8r
cCs�t|t�r>t|�dkr t|�}nt|�dkr4td��t|�}nt�|dd��t|t�rtt|�dkrjtd��t|�}nt�|dd��t||||�}t	|�S)a�encrypt single block of data using DES, operates on 8-byte strings.

    :arg key:
        DES key as 7 byte string, or 8 byte string with parity bits
        (parity bit values are ignored).

    :arg input:
        plaintext block to encrypt, as 8 byte string.

    :arg salt:
        Optional 24-bit integer used to mutate the base DES algorithm in a
        manner specific to :class:`~passlib.hash.des_crypt` and its variants.
        The default value ``0`` provides the normal (unsalted) DES behavior.
        The salt functions as follows:
        if the ``i``'th bit of ``salt`` is set,
        bits ``i`` and ``i+24`` are swapped in the DES E-box output.

    :arg rounds:
        Optional number of rounds of to apply the DES key schedule.
        the default (``rounds=1``) provides the normal DES behavior,
        but :class:`~passlib.hash.des_crypt` and its variants use
        alternate rounds values.

    :raises TypeError: if any of the provided args are of the wrong type.
    :raises ValueError:
        if any of the input blocks are the wrong size,
        or the salt/rounds values are out of range.

    :returns:
        resulting 8-byte ciphertext block.
    r&rSzkey must be 7 or 8 bytesr0r(zinput block must be 8 bytes�input)
r/r0r1rr2r!rr4�des_encrypt_int_blockr)r(r<�salt�roundsr:rrrr�s!




cCs�|dkrtd��|dks |tkr(td��t|t�sBt�|dd��n|dksR|tkrZtd��t|t�stt�|dd��n|dks�|tkr�td	��td
ur�t�t	\}}}}}}	}
}dd�}t
||��}
|d
@d>|d@d>B|d@d?B|d@d?B}|dk�rd}}n@|d?d@|d@B}t|t�}|d?d@|d?d@B}t|t�}|�r�|d8}|
D�]Z\}}|d?|A|@}|d>|A|A|A}|||d?d
@||d?d
@A||d?d
@A||d?d
@A||d?d
@A|	|d?d
@A|
|d?d
@A||d?d
@AN}|d?|A|@}|d>|A|A|A}|||d?d
@||d?d
@A||d?d
@A||d?d
@A||d?d
@A|	|d?d
@A|
|d?d
@A||d?d
@AN}�qX||}}�qF|d?d @|d!>d"@B|d#?d$@B|d>d%@B}t|t
�S)&a�encrypt single block of data using DES, operates on 64-bit integers.

    this function is essentially the same as :func:`des_encrypt_block`,
    except that it operates on integers, and will NOT automatically
    expand 56-bit keys if provided (since there's no way to detect them).

    :arg key:
        DES key as 64-bit integer (the parity bits are ignored).

    :arg input:
        input block as 64-bit integer

    :arg salt:
        optional 24-bit integer used to mutate the base DES algorithm.
        defaults to ``0`` (no mutation applied).

    :arg rounds:
        optional number of rounds of to apply the DES key schedule.
        defaults to ``1``.

    :raises TypeError: if any of the provided args are of the wrong type.
    :raises ValueError:
        if any of the input blocks are the wrong size,
        or the salt/rounds values are out of range.

    :returns:
        resulting ciphertext as 64-bit integer.
    r
zrounds must be positive integerrz(salt must be 24-bit non-negative integer�intr(r6r<z)input must be 64-bit non-negative integerNcss8tD].\}}t||�}t||�}|t@|t@fVqdS)zCgiven 64-bit key, iterates over the 8 (even,odd) key schedule pairsN)rr�_KS_MASK)�ks_oddZp_evenZp_odd�ks_evenrrr�_iter_key_schedules

z1des_encrypt_int_block.<locals>._iter_key_schedule�?�i��i�r	i�rU�l�*UUiUUUUr
�:�2�*�"��
�l<<xx�!l�C��#il�p�a)r2�INT_24_MASKr/rrr4r9rrr�listrr
r)r(r<r>r?ZSPE0ZSPE1ZSPE2ZSPE3ZSPE4ZSPE5ZSPE6ZSPE7rDZks_list�L�RrCrB�k�B�Crrrr=�s�"



�
�
��



 ������ ������


�
�
��	r=)rr
)rr
)!�__doc__�structZpasslibrZpasslib.utils.compatrrrr�__all__rRr3r9Z_KDATA_MASKZ
_KPARITY_MASKrArr
rrrr�Structrrr!r"r$r5rr8rr=rrrr�<module>s8.�
k

8

Youez - 2016 - github.com/yon3zu
LinuXploit