Your IP : 3.142.195.79


Current Path : /opt/alt/python35/lib64/python3.5/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/__pycache__/base64.cpython-35.opt-2.pyc



���]P�@sqddlZddlZddlZdddddddd	d
ddd
ddddddgZeefZdd�Zddd�Zdddd�Z	dd�Z
dd�Zejdd�Z
ejdd�Zdd�Zdd�ZdZdadad d�Zddd!d	�Zd"d
�Zdd#d�Zdadad$Zd%Zdddd&d'�Zd(dd)dd*dd+dd,d�Zd(dd+dd-d.d/d�Zd0Zda da!da"dd1d�Z#d2d
�Z$d3Z%e%d4d5Z&d6d�Z'd7d�Z(d8d9�Z)d:d�Z*d;d<�Z+d=d�Z,d>d?�Z-d@dA�Z.dBdC�Z/e0dDkrme.�dS)E�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"cCsBtj|�dd�}|dk	r>|jtjd|��S|S)N�s+/���)�binascii�
b2a_base64�	translate�bytes�	maketrans)r�altchars�encodedr r r!r3sFcCstt|�}|dk	r?t|�}|jtj|d��}|rgtjd|�rgtjd��tj|�S)Ns+/s^[A-Za-z0-9+/]*={0,2}$zNon-base64 digit found)	r"r'r(r)�re�matchr%�Error�
a2b_base64)rr*Zvalidater r r!rBscCs
t|�S)N)r)rr r r!r[scCs
t|�S)N)r)rr r r!rbss+/s-_cCst|�jt�S)N)rr'�_urlsafe_encode_translation)rr r r!rpscCs%t|�}|jt�}t|�S)N)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|dkr>d|dd�<nZ|dkr]d|dd�<n;|dkr|d|dd�<n|dkr�d|dd�<t|�S)NcSsg|]}t|f��qSr )r()�.0�ir r r!�
<listcomp>�s	zb32encode.<locals>.<listcomp>cs'g|]}�D]}||�qqSr r )r2�a�b)�b32tabr r!r4�s	�r�big��i��
r#s======��s====��s===�=i����������r$)�_b32tab2�_b32alphabetrrrr�lenr(�	bytearray�int�
from_bytes�range)rZleftoverr+rIZb32tab2r3�cr )r7r!r�s4		+c
CsWtdkr%dd�tt�D�at|�}t|�drPtjd��|dk	r�t|�}|jtj	dd|��}|r�|j
�}t|�}|jd�}|t|�}t�}t}x�t
dt|�d�D]�}|||d�}d}	y'x |D]}
|	d	>||
}	qWWn$tk
rYtjd
�d�YnX||	jd	d�7}q�W|rM|	d	|K}	|	jd	d�}|dkr�|dd�|dd�<n�|d
kr�|dd�|dd�<na|dkr|dd�|dd�<n8|dkr>|dd�|dd�<ntjd��t|�S)NcSsi|]\}}||�qSr r )r2�k�vr r r!�
<dictcomp>�s	zb32decode.<locals>.<dictcomp>�zIncorrect paddings01�OrArr8zNon-base32 digit foundr9r#r@r>r?r=r$������rQrCrQrBrQ)�_b32rev�	enumeraterEr"rFr%r.r'r(r)�upper�rstriprGrJ�KeyError�to_bytes)r�casefoldZmap01�lZpadchars�decodedZb32revr3Zquanta�accrKZlastr r r!r	�sJ	

cCstj|�j�S)N)r%ZhexlifyrU)rr r r!r
�scCsLt|�}|r|j�}tjd|�r?tjd��tj|�S)Ns	[^0-9A-F]zNon-base16 digit found)r"rUr,�searchr%r.Z	unhexlify)rrYr 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)Nr?sz!%dIcseg|][}�r|rdn?�r7|dkr7dn'�|d�|dd�|d�qS)�zi    �yi�^	�Ui9r )r2Zword)�chars�chars2�foldnuls�
foldspacesr r!r4)s	z_85encode.<locals>.<listcomp>r#r^rr8�r$r$r$r$)	rrrrrF�struct�Struct�unpack�join)	r6rarb�padrcrd�paddingZwords�chunksr )rarbrcrdr!�	_85encodes&

rmrd�wrapcolrj�adobecstdkr;dd�tdd�D�add�tD�at|tt|d|��|rft���r�t|r{dnd�����fd	d�td
t����D�}|r�t|d
�d�kr�|jd�dj|��|r�t	7��S)NcSsg|]}t|f��qSr )r()r2r3r r r!r4Ls	za85encode.<locals>.<listcomp>�!�vcSs'g|]}tD]}||�qqSr )�	_a85chars)r2r5r6r r r!r4Ms	Tr>r#cs$g|]}�||���qSr r )r2r3)�resultrnr r!r4Us	rres
r$)
rrrJ�
_a85chars2rm�	_A85START�maxrF�appendri�_A85END)r6rdrnrjrorlr )rsrnr!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|�dkr�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)Nz1Ascii85 encoded byte sequences must end with {!r}r>z!I�ur?�!rr8r`rpzAscii85 overflowr^zz inside Ascii85 5-tuplesr_zy inside Ascii85 5-tuples    zNon-Ascii85 digit found: %crerRrRsuuuurp�u�z�y)r"�endswithrxr�format�
startswithrurfrg�packrw�clearrF�errorri)r6rdrory�packIr[Zdecoded_appendZcurrZcurr_appendZ
curr_clear�xr\rsrkr r r!r`sV			




sU0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!#$%&()*+-;<=>?@^_`{|}~cCsEtdkr2dd�tD�add�tD�at|tt|�S)NcSsg|]}t|f��qSr )r()r2r3r r r!r4�s	zb85encode.<locals>.<listcomp>cSs'g|]}tD]}||�qqSr )�	_b85chars)r2r5r6r r r!r4�s	)r��_b85alphabet�
_b85chars2rm)r6rjr 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)
N�r8�~z!Irr`z#bad base85 character at position %dz+base85 overflow in hunk starting at byte %dre)�_b85decrTr�r"rFrfrgr�rJrrrwr�ri)
r6r3rKrk�outr��chunkr\�jrsr r r!r
�s<


�Lr?r@cCs�xy|jt�}|sPx@t|�tkr[|jtt|��}|sNP||7}qWtj|�}|j|�qWdS)N)�read�
MAXBINSIZErFr%r&�write)�input�outputr�ns�liner r r!r�scCs:x3|j�}|sPtj|�}|j|�qWdS)N)�readliner%r/r�)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 %srKr6�Bz-expected single byte elements, not %r from %sr#z(expected 1-D data, not %d-D data from %s)rKr6r�)rrrrr��ndim)r�m�err�msgr r r!�_input_type_checks"r�cCsjt|�g}xJtdt|�t�D]0}|||t�}|jtj|��q)Wdj|�S)Nrre)r�rJrFr�rwr%r&ri)r�piecesr3r�r r r!rs
cCs)ddl}|jdtd�t|�S)NrzAencodestring() is a deprecated alias since 3.1, use encodebytes()r>)�warnings�warn�DeprecationWarningr)rr�r r r!�encodestrings	
r�cCst|�tj|�S)N)r�r%r/)rr r r!r's
cCs)ddl}|jdtd�t|�S)NrzHdecodestring() 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	}|dkr�t	}|d	kr�t
�dSq�W|rW|dd
krWt|dd��}|||jj�WdQRXn||j
j|jj�dS)Nrr#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�or5�fr r r!�main6s0)
 r�cCsRd}tt|��t|�}tt|��t|�}tt|��dS)NsAladdin:open sesame)r��reprrr)Zs0�s1�s2r r r!r�Psr��__main__)1r,rfr%�__all__r(rGrr"rrrrr)r0r1rrrErDrSrr	r
rrrrtrurxrmrrr�r�r�r�rr
ZMAXLINESIZEr�rrr�rr�rr�r�r�rr r r r!�<module>	sf	&J$)H-	
	



?>