grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026o ±f‡j_Vã@sàdZddlZddlZddlZgd¢ZeefZdd„ZdQdd„Z dRd d „Z d d „Z d d„Z e  dd¡Ze  dd¡Zdd„Zdd„ZdZdZdZdZdZiaiadd„ZdSdd„Zdd„Zejd d!�e_dSd"d#„Zejd ed$�e_d%d&„Zejd'd!�e_dTd(d)„Zejd'd*d$�e_d+d,„Z dTd-d.„Z!da"da#d/Z$d0Z%dUd1d2„Z&ddddd3œd4d5„Z'ddd6d7œd8d9„Z(d:Z)da*da+da,dTd;d<„Z-d=d>„Z.d?Z/e/d@dAZ0dBdC„Z1dDdE„Z2dFdG„Z3dHdI„Z4dJdK„Z5dLdM„Z6dNdO„Z7e8dPkrîe6ƒdSdS)VzDBase16, Base32, Base64 (RFC 3548), Base85 and Ascii85 data encodingséN)ÚencodeÚdecodeÚ encodebytesÚ decodebytesÚ b64encodeÚ b64decodeÚ b32encodeÚ b32decodeÚ b32hexencodeÚ b32hexdecodeÚ b16encodeÚ b16decodeÚ b85encodeÚ b85decodeÚ a85encodeÚ a85decodeÚstandard_b64encodeÚstandard_b64decodeÚurlsafe_b64encodeÚurlsafe_b64decodecCslt|tƒrz| d¡WStytdƒ‚wt|tƒr|Szt|ƒ ¡WSty5td|j j ƒd‚w)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/python310/lib64/python3.10/base64.pyÚ_bytes_from_decode_data"s"   ÿ  ÿÿÿr%cCs,tj|dd�}|dur| t d|¡¡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. F)ÚnewlineNó+/)ÚbinasciiÚ b2a_base64Ú translateÚbytesÚ maketrans)r"ÚaltcharsÚencodedr#r#r$r3srFcCsît|ƒ}d}|dur5t|ƒ}t|ƒdkrtd|›�ƒ‚dD]}||vr+||vr+|}nq| t |d¡¡}|rBt d|¡sBt  d¡‚t  |¡}|duruddl }|rd|j dt |ƒ›d |›d �tdd �|S|j dt |ƒ›d |›d �tdd �|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. Nézinvalid altchars: r's[A-Za-z0-9+/]*={0,2}zNon-base64 digit foundrúinvalid character z in Base64 data with altchars=z= and validate=True will be an error in future Python versions©Ú stacklevelz? and validate=False will be discarded in future Python versions)r%Úlenrr*r+r,ÚreÚ fullmatchr(ÚErrorÚ a2b_base64ÚwarningsÚwarnÚchrÚDeprecationWarningÚ FutureWarning)r"r-ZvalidateÚbadcharÚbÚresultr8r#r#r$rAs< €  ÿý üÿýrcCót|ƒS)zrEncode bytes-like object s using the standard Base64 alphabet. The result is returned as a bytes object. )rr!r#r#r$rmsrcCr@)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. )rr!r#r#r$rtsrr's-_cCst|ƒ t¡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_translationr!r#r#r$r‚srcCsjt|ƒ}d}dD] }||vr|}nq| t¡}t |¡}|dur3ddl}|jdt|ƒ›d�tdd�|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 '/'. Nr'rr0zD in URL-safe Base64 data will be discarded in future Python versionsr/r1) r%r*Ú_urlsafe_decode_translationr(r7r8r9r:r<)r"r=r>r?r8r#r#r$r‹s þ  þrzK Encode the bytes-like objects using {encoding} and return a bytes object. aƒ Decode the {encoding} 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. {extra_args} 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. a´ 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. s ABCDEFGHIJKLMNOPQRSTUVWXYZ234567s 0123456789ABCDEFGHIJKLMNOPQRSTUVcsR|tvrdd„|Dƒ‰‡fdd„ˆDƒt|<d‰t|tƒs#t|ƒ ¡}t|ƒd}|r3|dd|}tƒ}tj}t|}t dt|ƒdƒD]+}||||d…dƒ}|||d?||d ?d @||d ?d @||d @7}qE|d krd |dd…<t |ƒS|dkr�d|dd…<t |ƒS|dkr›d|dd…<t |ƒS|dkr¥d|dd…<t |ƒS)NcSóg|]}t|fƒ‘qSr#©r+©Ú.0Úir#r#r$Ú Èóz_b32encode..csg|] }ˆD]}||‘qqSr#r#©rFÚar>©Zb32tabr#r$rHÉóéórÚbigééiÿé és======iúÿÿÿr/s====éüÿÿÿés===éýÿÿÿéó=éÿÿÿÿ) Ú_b32tab2rrrrr3Ú bytearrayÚintÚ from_bytesÚranger+)Úalphabetr"Úleftoverr.r^Zb32tab2rGÚcr#rLr$Ú _b32encodeÃsB    ÿþ ý ú ü þ rcc Cst|tvrdd„t|ƒDƒt|<t|ƒ}t|ƒdrt d¡‚|dur1t|ƒ}| t dd|¡¡}|r7|  ¡}t|ƒ}|  d¡}|t|ƒ}t ƒ}t|}t dt|ƒdƒD]1}|||d…} d} z| D] } | d >|| } qdWn t y}t d ¡d‚w||  d d ¡7}qU|ds�|d vr”t d¡‚|r¶|r¶| d |K} |  d d ¡} d d |d} | d| …|dd…<t|ƒS)NcSsi|]\}}||“qSr#r#)rFÚkÚvr#r#r$Ú ìrIz_b32decode..ézIncorrect paddings01óOrYrrNzNon-base32 digit foundrP>rrTrVrXéé+éûÿÿÿ)Ú_b32revÚ enumerater%r3r(r6r*r+r,ÚupperÚrstripr\r_ÚKeyErrorÚto_bytes)r`r"ÚcasefoldÚmap01ÚlZpadcharsÚdecodedZb32revrGZquantaÚaccrbZlastrar#r#r$Ú _b32decodeçsD    ÿ  ÿ   rwcCó tt|ƒS©N)rcÚ _b32alphabetr!r#r#r$ró rZbase32)ÚencodingcCstt|||ƒSry)rwrz)r"rrrsr#r#r$r sr )r|Z extra_argscCrxry)rcÚ_b32hexalphabetr!r#r#r$r r{r Z base32hexcCs tt||ƒSry)rwr}©r"rrr#r#r$r #s r ÚcCst |¡ ¡S)zKEncode the bytes-like object s using Base16 and return a bytes object. )r(Zhexlifyrnr!r#r#r$r -sr cCs4t|ƒ}|r | ¡}t d|¡rt d¡‚t |¡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%rnr4Úsearchr(r6Z unhexlifyr~r#r#r$r 3s     r s<~s~>c s¬t|tƒs t|ƒ ¡}t|ƒ d}|r|d|}t dt|ƒd¡ |¡}‡‡‡‡fdd„|Dƒ}|rQ|sQ|ddkrFˆdd |d<|dd| …|d<d  |¡S) NrXrOz!%dIcsPg|]$}ˆr |s dnˆr|dkrdnˆ|dˆ|ddˆ|d‘qS)ózi óyií^ éUi9r#)rFZword©ÚcharsÚchars2ÚfoldnulsÚ foldspacesr#r$rHWs û ÿ þþz_85encode..rZr�rrNó) rrrrr3ÚstructÚStructZunpackÚjoin) r>r…r†Úpadr‡rˆÚpaddingZwordsÚchunksr#r„r$Ú _85encodeMs   û  r�)rˆÚwrapcolr�Úadobecsºtdurdd„tddƒDƒadd„tDƒat|tt|d|ƒ‰|r$tˆ‰ˆrUt|r+dnd ˆƒ‰‡‡fd d„td tˆƒˆƒDƒ}|rPt|d ƒdˆkrP| d ¡d |¡‰|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. NcSrCr#rDrEr#r#r$rHzrIza85encode..é!évcSóg|] }tD]}||‘qqSr#)Ú _a85charsrJr#r#r$rH{rMTr/rTcsg|] }ˆ||ˆ…‘qSr#r#rE©r?r‘r#r$rHƒsÿrrZr‰ó ) Ú _a85chars2r_r–r�Ú _A85STARTÚmaxr3ÚappendrŒÚ_A85END)r>rˆr‘r�r’r�r#r—r$res$ ÿ  rs )rˆr’Ú ignorecharsc Cszt|ƒ}|r$| t¡std t¡ƒ‚| t¡r|dd…}n|dd…}t d¡j }g}|j }g}|j }|j } |dD]k} d| krGdkr|nn3|| ƒt |ƒd kr{d } |D] } d | | d} qWz||| ƒƒWn tj ywtd ƒd‚w| ƒq;| d kr‹|r†tdƒ‚|dƒq;|rœ| dkrœ|r—tdƒ‚|dƒq;| |vr¡q;td| ƒ‚d |¡} 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/éþÿÿÿNú!Isuuuur“éurNrrƒzAscii85 overflowézzz inside Ascii85 5-tupleséyzy inside Ascii85 5-tuples zNon-Ascii85 digit found: %cr‰rX)r%Úendswithr�rÚformatÚ startswithršrŠr‹ÚpackrœÚclearr3ÚerrorrŒ)r>rˆr’ržÚpackIruZdecoded_appendZcurrZ curr_appendZ curr_clearÚxrvr?rŽr#r#r$rŽs\ þ      ÿ€      rsU0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!#$%&()*+-;<=>?@^_`{|}~cCs2tdurdd„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. NcSrCr#rDrEr#r#r$rHærIzb85encode..cSr•r#)Ú _b85charsrJr#r#r$rHçrM)Ú _b85chars2Ú _b85alphabetr¬r�)r>r�r#r#r$rÜs rc Cs8tdurdgdattƒD]\}}|t|<q t|ƒ}t|ƒ d}|d|}g}t d¡j}tdt|ƒdƒD]T}|||d…}d}z|D] }|dt|}qFWn t yrt|ƒD]\}}t|durpt d||ƒd‚q]‚wz |  ||ƒ¡Wq7tj y‹t d |ƒd‚wd   |¡} |rš| d| …} | S) zqDecode the base85-encoded bytes-like object or ASCII string b The result is returned as a bytes object. NérNó~r rrƒz#bad base85 character at position %dz+base85 overflow in hunk starting at byte %dr‰)Ú_b85decrmr®r%r3rŠr‹r§r_rrrœr©rŒ) r>rGrbrŽÚoutrªÚchunkrvÚjr?r#r#r$rêsP    ÿ  ÿÿÿûÿÿÿ réLrXrVcCsb | t¡}|s dSt|ƒtkr&| tt|ƒ¡}|sn ||7}t|ƒtkst |¡}| |¡q)z1Encode a file; input and output are binary files.TN)ÚreadÚ MAXBINSIZEr3r(r)Úwrite)ÚinputÚoutputr"ÚnsÚliner#r#r$rs   ü  örcCs( | ¡}|s dSt |¡}| |¡q)z1Decode a file; input and output are binary files.TN)Úreadliner(r7r¸)r¹rºr¼r"r#r#r$r)s  ûrc Csˆzt|ƒ}Wnty}z d|jj}t|ƒ|‚d}~ww|jdvr0d|j|jjf}t|ƒ‚|jdkrBd|j|jjf}t|ƒ‚dS)Nz"expected bytes-like object, not %s)rbr>ÚBz-expected single byte elements, not %r from %srTz(expected 1-D data, not %d-D data from %s)rrrr r¥Úndim)r"ÚmÚerrÚmsgr#r#r$Ú_input_type_check2s$   €þ  ÿ  ÿýrÃcCsLt|ƒg}tdt|ƒtƒD]}|||t…}| t |¡¡qd |¡S)zVEncode a bytestring into a bytes object containing multiple lines of base-64 data.rr‰)rÃr_r3r·rœr(r)rŒ)r"ÚpiecesrGr³r#r#r$rBs  rcCst|ƒt |¡S)z8Decode a bytestring of base-64 data into a bytes object.)rÃr(r7r!r#r#r$rMs rc Cs4ddl}ddl}z| |jdd…d¡\}}Wn)|jy@}z|j|_t|ƒtd|jdƒ| d¡WYd}~nd}~wwt}|D] \}}|dkrOt}|dkrUt }|d kr[t }|d kret ƒdSqE|r�|dd kr�t |dd ƒ�}|||jj ƒWdƒdS1sˆwYdS||j j |jj ƒdS) zSmall main programrNrTZdeutz�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ÚorKÚfr#r#r$ÚmainTs.ý€ù    "ÿrÖcCs<d}tt|ƒƒt|ƒ}tt|ƒƒt|ƒ}tt|ƒƒdS)NsAladdin:open sesame)rÌÚreprrr)Zs0Ús1Ús2r#r#r$rÎns   rÎÚ__main__ry)NF)FN)F)FFF)9Ú__doc__r4rŠr(Ú__all__r+r\rr%rrrrr,rArBrrZ_B32_ENCODE_DOCSTRINGZ_B32_DECODE_DOCSTRINGZ_B32_DECODE_MAP01_DOCSTRINGrzr}r[rlrcrwrr¥r r r r r r–r™ršr�r�rrr®r¬r­r±rrZ MAXLINESIZEr·rrrÃrrrÖrÎr r#r#r#r$Ús~  ,     $/ ÿ ÿ  )H -    ÿ