Files
PowerToys/PythonHome/Lib/base64.pyc

103 lines
11 KiB
Plaintext
Raw Normal View History

2014-07-09 18:15:23 +08:00
<03>
<EFBFBD>W`Sc@s<>dZddlZddlZddlZddddddd d
d d d dddgZged<00>D]Zee<00>^qgZdZ d<00>Z
2014-07-10 23:57:08 +08:00
dd<00>Z dd<00>Z d<00>Zd<00>Zd<00>Zd<00>Zi dd6dd6dd6d d!6d"d#6d$d%6d&d'6d(d)6d*d+6d,d-6d.d/6d0d16d2d36d4d56d6d76d8d96d:d;6d<d=6d>d?6d@dA6dBdC6dDdE6dFdG6dHdI6dJdK6dLdM6dNdO6dPdQ6dRdS6dTdU6dVdW6dXdY6Zej<00>Zej<00>geD]\ZZe^q<>Zegej<00>D]\ZZeee<00>f^q<><01>ZdZ<00>Zedd[<00>Zd\<00>Zed]<00>Zd^Z e d;d3Z!d_<00>Z"d`<00>Z#da<00>Z$db<00>Z%dc<00>Z&dd<00>Z'e(dekr<>e&<00>ndS(fs/RFC 3548: Base16, Base32, Base64 Data Encodingsi<73><69><EFBFBD><EFBFBD>Ntencodetdecodet encodestringt decodestringt b64encodet b64decodet b32encodet b32decodet b16encodet b16decodetstandard_b64encodetstandard_b64decodeturlsafe_b64encodeturlsafe_b64decodeitcCsJt}x*|j<00>D]\}}||t|<00><qW|jdj|<00><00>S(NR(t _translationtitemstordt translatetjoin(tstaltcharst translationtktv((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\base64.pyt
2014-07-09 18:15:23 +08:00
_translate scCsFtj|<00>d }|dk rBt|i|dd6|dd6<>S|S(slEncode a string using Base64.
s is the string to encode. Optional altchars must be a string of at least
length 2 (additional characters are ignored) which specifies an
alternative alphabet for the '+' and '/' characters. This allows an
application to e.g. generate url or filesystem safe Base64 strings.
The encoded string is returned.
i<><69><EFBFBD><EFBFBD>it+it/N(tbinasciit
2014-07-10 23:57:08 +08:00
b2a_base64tNoneR(RRtencoded((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\base64.pyR*s  #cCsn|dk r4t|id|d6d|d6<>}nytj|<00>SWn"tjk
2014-07-09 18:15:23 +08:00
ri}t|<00><00>nXdS(s<>Decode a Base64 encoded string.
s is the string to decode. Optional altchars must be a string of at least
length 2 (additional characters are ignored) which specifies the
alternative alphabet used instead of the '+' and '/' characters.
The decoded string is returned. A TypeError is raised if s were
incorrectly padded or if there are non-alphabet characters present in the
string.
RiRiN(RRRt
2014-07-10 23:57:08 +08:00
a2b_base64tErrort TypeError(RRtmsg((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\base64.pyR;s (cCs
2014-07-09 18:15:23 +08:00
t|<00>S(syEncode a string using the standard Base64 alphabet.
s is the string to encode. The encoded string is returned.
2014-07-10 23:57:08 +08:00
(R(R((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\base64.pyR
2014-07-09 18:15:23 +08:00
OscCs
t|<00>S(sDecode a string encoded with the standard Base64 alphabet.
s is the string to decode. The decoded string is returned. A TypeError
is raised if the string is incorrectly padded or if there are non-alphabet
characters present in the string.
2014-07-10 23:57:08 +08:00
(R(R((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\base64.pyR VscCs t|d<00>S(s<>Encode a string using a url-safe Base64 alphabet.
2014-07-09 18:15:23 +08:00
s is the string to encode. The encoded string is returned. The alphabet
uses '-' instead of '+' and '_' instead of '/'.
2014-07-10 23:57:08 +08:00
s-_(R(R((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\base64.pyR _scCs t|d<00>S(sDDecode a string encoded with the standard Base64 alphabet.
2014-07-09 18:15:23 +08:00
s is the string to decode. The decoded string is returned. A TypeError
is raised if the string is incorrectly padded or if there are non-alphabet
characters present in the string.
The alphabet uses '-' instead of '+' and '_' instead of '/'.
2014-07-10 23:57:08 +08:00
s-_(R(R((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\base64.pyR gs tAitJi tSit3itBitKi
2014-07-09 18:15:23 +08:00
tTit4itCitLi tUit5itDitMi tVit6itEitNi tWit7itFitOitXitGitPitYitHitQitZitIitRit2ic Cs<>g}tt|<00>d<00>\}}|rF|dd|7}|d7}nx<>t|<00>D]<5D>}tjd||d|dd!<21>\}}}||d@d>7}||d@d>7}|jt|d?t|d ?d
@t|d?d
@t|d ?t|d ?d
@t|d ?d
@t|d?t|d
@g<00>qSWtj|<00>}|dkrK|d dS|d krc|d dS|dkr{|d dS|dkr<>|d dS|S(scEncode a string using Base32.
s is the string to encode. The encoded string is returned.
2014-07-10 23:57:08 +08:00
itis!HHBiiii iii iii<><69><EFBFBD><EFBFBD>s======i<><69><EFBFBD><EFBFBD>s====i<><69><EFBFBD><EFBFBD>s===ii<><69><EFBFBD><EFBFBD>t=( tdivmodtlentrangetstructtunpacktextendt_b32tabt EMPTYSTRINGR( Rtpartstquantatleftovertitc1tc2tc3R((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\base64.pyR<00>s6 .          c Cs tt|<00>d<00>\}}|r0td<00><00>n|rVt|idd6|d6<>}n|rk|j<00>}nd}tjd|<00>}|r<>t|jd<00><00>}|dkr<>|| }q<>ng}d}d } x<>|D]<5D>}
2014-07-09 18:15:23 +08:00
tj |
<00>} | dkrtd
<00><00>n|t|
| >7}| d 8} | dkr<>|j t j d |<16><00>d}d } q<>q<>Wt j d |<16>} |dkr<>d } np|dkr<>| d } nW|dkr<>| d } n>|dkr<>| d } n%|dkr<>| d } n td<00><00>|j | <00>tj|<00>S(sGDecode a Base32 encoded string.
s is the string to decode. 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 decoded string is returned. A TypeError is raised if s were
incorrectly padded or if there are non-alphabet characters present in the
string.
2014-07-10 23:57:08 +08:00
isIncorrect paddingR9t0t1is(?P<pad>[=]*)$tpadi#sNon-base32 digit foundis%010xRii<><69><EFBFBD><EFBFBD>ii<><69><EFBFBD><EFBFBD>ii<><69><EFBFBD><EFBFBD>ii<><69><EFBFBD><EFBFBD>N(RFRGR"Rtuppertretsearchtgroupt_b32revtgetRtappendRt unhexlifyRMR( Rtcasefoldtmap01RORPtpadcharstmoRNtacctshifttctvaltlast((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\base64.pyR<00>sP    
2014-07-09 18:15:23 +08:00
              cCstj|<00>j<00>S(scEncode a string using Base16.
s is the string to encode. The encoded string is returned.
2014-07-10 23:57:08 +08:00
(RthexlifyRX(R((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\base64.pyR<00>scCsC|r|j<00>}ntjd|<00>r6td<00><00>ntj|<00>S(swDecode a Base16 encoded string.
2014-07-09 18:15:23 +08:00
s is the string to decode. Optional casefold is a flag specifying whether
a lowercase alphabet is acceptable as input. For security purposes, the
default is False.
The decoded string is returned. A TypeError is raised if s were
incorrectly padded or if there are non-alphabet characters present in the
string.
2014-07-10 23:57:08 +08:00
s [^0-9A-F]sNon-base16 digit found(RXRYRZR"RR_(RR`((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\base64.pyR s
2014-07-09 18:15:23 +08:00
iLcCs<>x<>tr<>|jt<00>}|s"PnxCt|<00>tkrg|jtt|<00><18>}|sZPn||7}q%Wtj|<00>}|j|<00>qWdS(sEncode a file.N(tTruetreadt
2014-07-10 23:57:08 +08:00
MAXBINSIZERGRRtwrite(tinputtoutputRtnstline((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\base64.pyRs cCsCx<tr>|j<00>}|sPntj|<00>}|j|<00>qWdS(sDecode a file.N(RjtreadlineRR Rm(RnRoRqR((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\base64.pyR,s   cCs]g}xGtdt|<00>t<00>D]-}|||t!}|jtj|<00><00>qWdj|<00>S(s4Encode a string into multiple lines of base-64 data.iR(RHRGRlR^RRR(RtpiecesRQtchunk((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\base64.pyR6s
cCs tj|<00>S(sDecode a string.(RR (R((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\base64.pyR?sc CsQddl}ddl}y#|j|jdd<00>\}}WnD|jk
2014-07-09 18:15:23 +08:00
r<>}|j|_|GHd|jdGH|jd<00>nXt}xj|D]b\}}|dkr<>t}n|d kr<>t}n|d
kr<>t}n|d kr<>t <00>dSq<53>W|r:|dd kr:t
|dd <00><00>}|||j<00>WdQXn||j |j<00>dS(sSmall test programi<6D><69><EFBFBD><EFBFBD>Nitdeuts<74>usage: %s [-d|-e|-u|-t] [file|-]
-d, -u: decode
-e: encode (default)
2014-07-10 23:57:08 +08:00
-t: encode and decode string 'Aladdin:open sesame'iis-es-ds-us-tt-trb( tsystgetopttargvterrortstderrtstdouttexitRRttest1topentstdin( RxRytoptstargsR#tfunctotatf((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\base64.pyttestFs.#     cCs5d}t|<00>}t|<00>}|Gt|<00>G|GHdS(NsAladdin:open sesame(RRtrepr(ts0ts1ts2((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\base64.pyR`s  t__main__()t__doc__RYRIRt__all__RHt_xtchrRRMRRRRR
R R R t _b32alphabetRRLtsortRRtdicttlongR\RtFalseRRR t MAXLINESIZERlRRRRR<>Rt__name__(((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\base64.pyt<module>sZ      %
2014-07-09 18:15:23 +08:00
     
7 *J