Hacked By AnonymousFox

Current Path : /proc/thread-self/root/proc/self/root/opt/alt/python35/lib64/python3.5/__pycache__/
Upload File :
Current File : //proc/thread-self/root/proc/self/root/opt/alt/python35/lib64/python3.5/__pycache__/base64.cpython-35.pyc



��Yf*P�@swdZddlZddlZddlZddddddd	d
ddd
dddddddgZeefZdd�Zddd�Z	dddd�Z
dd�Zdd�Zej
dd�Zej
dd�Zdd�Zdd�Zd Zdadad!d	�Zddd"d
�Zd#d�Zdd$d�Zdadad%Zd&Zdddd'd(�Zd)dd*dd+dd,dd-d�Zd)dd,dd.d/d0d�Zd1Z da!da"da#dd2d
�Z$d3d�Z%d4Z&e&d5d6Z'd7d�Z(d8d�Z)d9d:�Z*d;d�Z+d<d=�Z,d>d�Z-d?d@�Z.dAdB�Z/dCdD�Z0e1dEkrse/�dS)FzDBase16, Base32, Base64 (RFC 3548), Base85 and Ascii85 data encodings�N�encode�decode�encodebytes�decodebytes�	b64encode�	b64decode�	b32encode�	b32decode�	b16encode�	b16decode�	b85encode�	b85decode�	a85encode�	a85decode�standard_b64encode�standard_b64decode�urlsafe_b64encode�urlsafe_b64decodecCs�t|t�rAy|jd�SWntk
r@td��YnXt|t�rT|Syt|�j�SWn+tk
r�td|j	j
�d�YnXdS)N�asciiz4string argument should contain only ASCII charactersz>argument should be a bytes-like object or ASCII string, not %r)�
isinstance�strr�UnicodeEncodeError�
ValueError�bytes_types�
memoryview�tobytes�	TypeError�	__class__�__name__)�s�r �+/opt/alt/python35/lib64/python3.5/base64.py�_bytes_from_decode_data"s

r"cCsftj|�dd�}|dk	rbt|�dksItt|���|jtjd|��S|S)a*Encode the bytes-like object s using Base64 and return a bytes object.

    Optional altchars should be a byte string of length 2 which specifies an
    alternative alphabet for the '+' and '/' characters.  This allows an
    application to e.g. generate url or filesystem safe Base64 strings.
    N��s+/���)�binascii�
b2a_base64�len�AssertionError�repr�	translate�bytes�	maketrans)r�altchars�encodedr r r!r3s
$FcCs�t|�}|dk	rct|�}t|�dksHtt|���|jtj|d��}|r�tjd|�r�t	j
d��t	j|�S)anDecode the Base64 encoded bytes-like object or ASCII string s.

    Optional altchars must be a bytes-like object or ASCII string of length 2
    which specifies the alternative alphabet used instead of the '+' and '/'
    characters.

    The result is returned as a bytes object.  A binascii.Error is raised if
    s is incorrectly padded.

    If validate is False (the default), characters that are neither in the
    normal base-64 alphabet nor the alternative alphabet are discarded prior
    to the padding check.  If validate is True, these non-alphabet characters
    in the input result in a binascii.Error.
    Nr$s+/s^[A-Za-z0-9+/]*={0,2}$zNon-base64 digit found)r"r(r)r*r+r,r-�re�matchr&�Error�
a2b_base64)rr.Zvalidater r r!rBs$cCs
t|�S)zrEncode bytes-like object s using the standard Base64 alphabet.

    The result is returned as a bytes object.
    )r)rr r r!r[scCs
t|�S)aQDecode bytes encoded with the standard Base64 alphabet.

    Argument s is a bytes-like object or ASCII string to decode.  The result
    is returned as a bytes object.  A binascii.Error is raised if the input
    is incorrectly padded.  Characters that are not in the standard alphabet
    are discarded prior to the padding check.
    )r)rr r r!rbss+/s-_cCst|�jt�S)z�Encode bytes using the URL- and filesystem-safe Base64 alphabet.

    Argument s is a bytes-like object to encode.  The result is returned as a
    bytes object.  The alphabet uses '-' instead of '+' and '_' instead of
    '/'.
    )rr+�_urlsafe_encode_translation)rr r r!rpscCs%t|�}|jt�}t|�S)a�Decode bytes using the URL- and filesystem-safe Base64 alphabet.

    Argument s is a bytes-like object or ASCII string to decode.  The result
    is returned as a bytes object.  A binascii.Error is raised if the input
    is incorrectly padded.  Characters that are not in the URL-safe base-64
    alphabet, and are not a plus '+' or slash '/', are discarded prior to the
    padding check.

    The alphabet uses '-' instead of '+' and '_' instead of '/'.
    )r"r+�_urlsafe_decode_translationr)rr r r!ryss ABCDEFGHIJKLMNOPQRSTUVWXYZ234567cs�tdkr>dd�tD���fdd��D�ad�t|t�s_t|�j�}t|�d}|r�|td|�}t�}t	j
}t}x{tdt|�d�D]a}||||d�d�}|||d?||d	?d
@||d?d
@||d
@7}q�W|dkr>d
|dd�<nZ|dkr]d|dd�<n;|dkr|d|dd�<n|dkr�d|dd�<t|�S)zKEncode the bytes-like object s using Base32 and return a bytes object.
    NcSsg|]}t|f��qSr )r,)�.0�ir r r!�
<listcomp>�s	zb32encode.<locals>.<listcomp>cs'g|]}�D]}||�qqSr r )r6�a�b)�b32tabr r!r8�s	�r�big��i��
r#s======�r$s====��s===�=i����������r%)�_b32tab2�_b32alphabetrrrrr(r,�	bytearray�int�
from_bytes�range)rZleftoverr/rKZb32tab2r7�cr )r;r!r�s4		+c
Cs{tdkr%dd�tt�D�at|�}t|�drPtjd��|dk	r�t|�}t|�dks�tt|���|j	t
jdd|��}|r�|j�}t|�}|j
d	�}|t|�}t�}t}x�td
t|�d�D]�}|||d�}d
}	y'x |D]}
|	d>||
}	q:WWn$tk
r}tjd�d�YnX||	jdd
�7}qW|rq|	d|K}	|	jdd
�}|dkr�|dd�|dd�<n�|dkr|dd�|dd�<na|dkr9|dd�|dd�<n8|dkrb|dd�|dd�<ntjd��t
|�S)aZDecode the Base32 encoded bytes-like object or ASCII string s.

    Optional casefold is a flag specifying whether a lowercase alphabet is
    acceptable as input.  For security purposes, the default is False.

    RFC 3548 allows for optional mapping of the digit 0 (zero) to the
    letter O (oh), and for optional mapping of the digit 1 (one) to
    either the letter I (eye) or letter L (el).  The optional argument
    map01 when not None, specifies which letter the digit 1 should be
    mapped to (when map01 is not None, the digit 0 is always mapped to
    the letter O).  For security purposes the default is None, so that
    0 and 1 are not allowed in the input.

    The result is returned as a bytes object.  A binascii.Error is raised if
    the input is incorrectly padded or if there are non-alphabet
    characters present in the input.
    NcSsi|]\}}||�qSr r )r6�k�vr r r!�
<dictcomp>�s	zb32decode.<locals>.<dictcomp>�zIncorrect paddingr#s01�OrDrr<zNon-base32 digit foundr=rCr$rBrAr%������rSrFrSrErS)�_b32rev�	enumeraterHr"r(r&r2r)r*r+r,r-�upper�rstriprIrL�KeyError�to_bytes)r�casefoldZmap01�lZpadchars�decodedZb32revr7Zquanta�accrMZlastr r r!r	�sL$	

cCstj|�j�S)zKEncode the bytes-like object s using Base16 and return a bytes object.
    )r&ZhexlifyrW)rr r r!r
�scCsLt|�}|r|j�}tjd|�r?tjd��tj|�S)a�Decode the Base16 encoded bytes-like object or ASCII string s.

    Optional casefold is a flag specifying whether a lowercase alphabet is
    acceptable as input.  For security purposes, the default is False.

    The result is returned as a bytes object.  A binascii.Error is raised if
    s is incorrectly padded or if there are non-alphabet characters present
    in the input.
    s	[^0-9A-F]zNon-base16 digit found)r"rWr0�searchr&r2Z	unhexlify)rr[r r r!rs
s<~s~>c	s�t|t�s!t|�j�}t|�d}|rF|d|}tjdt|�d�j|�}����fdd�|D�}|r�|r�|ddkr��dd	|d<|d
d|�|d<d
j|�S)NrBsz!%dIcseg|][}�r|rdn?�r7|dkr7dn'�|d�|dd�|d�qS)�zi    �yi�^	�Ui9r )r6Zword)�chars�chars2�foldnuls�
foldspacesr r!r8)s	z_85encode.<locals>.<listcomp>r#r`rr<�r%r%r%r%)	rrrrr(�struct�StructZunpack�join)	r:rcrd�padrerf�paddingZwords�chunksr )rcrdrerfr!�	_85encodes&

rnrf�wrapcolrk�adobecstdkr;dd�tdd�D�add�tD�at|tt|d|��|rft���r�t|r{dnd	�����fd
d�tdt����D�}|r�t|d�d�kr�|jd�d
j|��|r�t	7��S)a�Encode bytes-like object b using Ascii85 and return a bytes object.

    foldspaces is an optional flag that uses the special short sequence 'y'
    instead of 4 consecutive spaces (ASCII 0x20) as supported by 'btoa'. This
    feature is not supported by the "standard" Adobe encoding.

    wrapcol controls whether the output should have newline (b'\n') characters
    added to it. If this is non-zero, each output line will be at most this
    many characters long.

    pad controls whether the input is padded to a multiple of 4 before
    encoding. Note that the btoa implementation always pads.

    adobe controls whether the encoded byte sequence is framed with <~ and ~>,
    which is used by the Adobe implementation.
    NcSsg|]}t|f��qSr )r,)r6r7r r r!r8Ls	za85encode.<locals>.<listcomp>�!�vcSs'g|]}tD]}||�qqSr )�	_a85chars)r6r9r:r r r!r8Ms	Tr$r#cs$g|]}�||���qSr r )r6r7)�resultror r!r8Us	rrgs
r%)
rsrL�
_a85chars2rn�	_A85START�maxr(�appendrj�_A85END)r:rfrorkrprmr )rtror!r7s"


�ignorecharss 	

cCst|�}|rh|jt�s6tdjt���|jt�rX|dd�}n|dd�}tjd�j	}g}|j
}g}|j
}|j}	x6|dD]*}
d|
ko�dknrX||
�t|�d	kr�d}x |D]}
d
||
d}q�Wy|||��Wn$tj
k
rMtd�d�YnX|	�q�|
dkr�|rvtd��|d�q�|r�|
dkr�|r�td��|d�q�|
|kr�q�q�td|
��q�Wdj|�}dt|�}
|
r|d|
�}|S)a�Decode the Ascii85 encoded bytes-like object or ASCII string b.

    foldspaces is a flag that specifies whether the 'y' short sequence should be
    accepted as shorthand for 4 consecutive spaces (ASCII 0x20). This feature is
    not supported by the "standard" Adobe encoding.

    adobe controls whether the input sequence is in Adobe Ascii85 format (i.e.
    is framed with <~ and ~>).

    ignorechars should be a byte string containing characters to ignore from the
    input. This should only contain whitespace characters, and by default
    contains all whitespace characters in ASCII.

    The result is returned as a bytes object.
    z1Ascii85 encoded byte sequences must end with {!r}r$Nz!I�urB�!rr<rbrqzAscii85 overflowr`zz inside Ascii85 5-tuplesrazy inside Ascii85 5-tuples    zNon-Ascii85 digit found: %crgrTrTsuuuurq�u�z�y)r"�endswithryr�format�
startswithrvrhri�packrx�clearr(�errorrj)r:rfrprz�packIr]Zdecoded_appendZcurrZcurr_appendZ
curr_clear�xr^rtrlr r r!r`sV			




sU0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!#$%&()*+-;<=>?@^_`{|}~cCsEtdkr2dd�tD�add�tD�at|tt|�S)z�Encode bytes-like object b in base85 format and return a bytes object.

    If pad is true, the input is padded with b'\0' so its length is a multiple of
    4 bytes before encoding.
    NcSsg|]}t|f��qSr )r,)r6r7r r r!r8�s	zb85encode.<locals>.<listcomp>cSs'g|]}tD]}||�qqSr )�	_b85chars)r6r9r:r r r!r8�s	)r��_b85alphabet�
_b85chars2rn)r:rkr r r!r�s	c
Cs�tdkr@dgdax$tt�D]\}}|t|<q&Wt|�}t|�d}|d|}g}tjd�j}x�tdt|�d�D]�}|||d�}d}y'x |D]}|dt|}q�WWnYt	k
r>xAt|�D]3\}}t|dkrt
d||�d�qW�YnXy|j||��Wq�tjk
r�t
d	|�d�Yq�Xq�Wd
j
|�}	|r�|	d|�}	|	S)zqDecode the base85-encoded bytes-like object or ASCII string b

    The result is returned as a bytes object.
    N�r<�~z!Irrbz#bad base85 character at position %dz+base85 overflow in hunk starting at byte %drg)�_b85decrVr�r"r(rhrir�rLrrrxr�rj)
r:r7rMrl�outr��chunkr^�jrtr r r!r
�s<


�LrBrCcCs�xy|jt�}|sPx@t|�tkr[|jtt|��}|sNP||7}qWtj|�}|j|�qWdS)z1Encode a file; input and output are binary files.N)�read�
MAXBINSIZEr(r&r'�write)�input�outputr�ns�liner r r!r�scCs:x3|j�}|sPtj|�}|j|�qWdS)z1Decode a file; input and output are binary files.N)�readliner&r3r�)r�r�r�rr r r!r�scCs�yt|�}WnDtk
rV}z$d|jj}t|�|�WYdd}~XnX|jdkr�d|j|jjf}t|��|jdkr�d|j|jjf}t|��dS)	Nz"expected bytes-like object, not %srMr:�Bz-expected single byte elements, not %r from %sr#z(expected 1-D data, not %d-D data from %s)rMr:r�)rrrrr��ndim)r�m�err�msgr r r!�_input_type_checks"r�cCsjt|�g}xJtdt|�t�D]0}|||t�}|jtj|��q)Wdj|�S)zVEncode a bytestring into a bytes object containing multiple lines
    of base-64 data.rrg)r�rLr(r�rxr&r'rj)r�piecesr7r�r r r!rs
cCs)ddl}|jdtd�t|�S)zLegacy alias of encodebytes().rNzAencodestring() is a deprecated alias since 3.1, use encodebytes()r$)�warnings�warn�DeprecationWarningr)rr�r r r!�encodestrings	
r�cCst|�tj|�S)z8Decode a bytestring of base-64 data into a bytes object.)r�r&r3)rr r r!r's
cCs)ddl}|jdtd�t|�S)zLegacy alias of decodebytes().rNzHdecodestring() is a deprecated alias since Python 3.1, use decodebytes()r$)r�r�r�r)rr�r r r!�decodestring,s	
r�c	Cstddl}ddl}y)|j|jdd�d�\}}Wn`|jk
r�}z=|j|_t|�td|jd�|jd�WYdd}~XnXt}xa|D]Y\}}|dkr�t}|dkr�t	}|d	kr�t	}|d
kr�t
�dSq�W|rW|ddkrWt|dd��}|||jj�WdQRXn||j
j|jj�dS)
zSmall main programrNr#Zdeutz�usage: %s [-d|-e|-u|-t] [file|-]
        -d, -u: decode
        -e: encode (default)
        -t: encode and decode string 'Aladdin:open sesame'r$z-ez-dz-uz-t�-�rb)�sys�getopt�argvr��stderr�stdout�print�exitrr�test�open�buffer�stdin)	r�r�Zopts�argsr��func�or9�fr r r!�main6s0)
 r�cCsdd}tt|��t|�}tt|��t|�}tt|��||ks`t�dS)NsAladdin:open sesame)r�r*rrr))Zs0�s1�s2r r r!r�Psr��__main__)2�__doc__r0rhr&�__all__r,rIrr"rrrrr-r4r5rrrHrGrUrr	r
rrsrurvryrnrrr�r�r�r�rr
ZMAXLINESIZEr�rrr�rr�rr�r�r�rr r r r!�<module>sh	&J$)H-	
	



Hacked By AnonymousFox1.0, Coded By AnonymousFox