o 0¦i|Q ã @ sà d Z ddlZddlZddlZg d¢ZeefZdd„ ZdQdd„Z dRd d „Z dd„ Zd d„ Ze dd¡Ze dd¡Zdd„ Zdd„ ZdZdZdZdZdZi ai add„ 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@ dA Z0dBdC„ Z1dDdE„ Z2dFdG„ Z3dHdI„ Z4dJdK„ Z5dLdM„ Z6dNdO„ Z7e8dPkrîe6ƒ dS dS )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_b64decodec C sl t | tƒrz| d¡W S ty tdƒ‚w t | tƒr| S zt| ƒ ¡ W S ty5 td| 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% c C s, t j| 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$ r 3 s r Fc C sN t | ƒ} |durt |ƒ}| t |d¡¡} |r"t d| ¡s"t d¡‚t | ¡S )an Decode 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 [A-Za-z0-9+/]*={0,2}zNon-base64 digit found) r% r* r+ r, ÚreÚ fullmatchr( ÚErrorÚ a2b_base64)r" r- Zvalidater# r# r$ r A s r c C ó t | ƒS )zrEncode bytes-like object s using the standard Base64 alphabet. The result is returned as a bytes object. )r r! r# r# r$ r Z s r c C r3 )aQ Decode 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 r! r# r# r$ r a s r r' s -_c C s t | ƒ 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 '/'. )r r* Ú_urlsafe_encode_translationr! r# r# r$ r o s r c C s t | ƒ} | t¡} 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 r! r# r# r$ r x s r zK 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 0123456789ABCDEFGHIJKLMNOPQRSTUVc sR | t vrdd„ | D ƒ‰ ‡ fdd„ˆ D ƒt | <