1 \section{Standard Module
\module{base64
}}
4 \indexii{base64
}{encoding
}
5 \index{MIME!base64 encoding
}
7 This module perform base64 encoding and decoding of arbitrary binary
8 strings into text strings that can be safely emailed or posted. The
9 encoding scheme is defined in
\rfc{1421} (``Privacy Enhancement for
10 Internet Electronic Mail: Part I: Message Encryption and
11 Authentication Procedures'', section
4.3.2.4, ``Step
4: Printable
12 Encoding'') and is used for MIME email and
13 various other Internet-related applications; it is not the same as the
14 output produced by the
\program{uuencode
} program. For example, the
15 string
\code{'www.python.org'
} is encoded as the string
16 \code{'d3d3LnB5dGhvbi5vcmc=
\e n'
}.
19 \begin{funcdesc
}{decode
}{input, output
}
20 Decode the contents of the
\var{input
} file and write the resulting
21 binary data to the
\var{output
} file.
22 \var{input
} and
\var{output
} must either be file objects or objects that
23 mimic the file object interface.
\var{input
} will be read until
24 \code{\var{input
}.read()
} returns an empty string.
27 \begin{funcdesc
}{decodestring
}{s
}
28 Decode the string
\var{s
}, which must contain one or more lines of
29 base64 encoded data, and return a string containing the resulting
33 \begin{funcdesc
}{encode
}{input, output
}
34 Encode the contents of the
\var{input
} file and write the resulting
35 base64 encoded data to the
\var{output
} file.
36 \var{input
} and
\var{output
} must either be file objects or objects that
37 mimic the file object interface.
\var{input
} will be read until
38 \code{\var{input
}.read()
} returns an empty string.
41 \begin{funcdesc
}{encodestring
}{s
}
42 Encode the string
\var{s
}, which can contain arbitrary binary data,
43 and return a string containing one or more lines of