Oops -- Lib/Test should be Lib/test, of course!
[python/dscho.git] / Doc / lib / libbase64.tex
blobdca25d012142df4c2e35e6e7cce46aa970e9c825
1 \section{Standard Module \module{base64}}
2 \label{module-base64}
3 \stmodindex{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.
25 \end{funcdesc}
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
30 binary data.
31 \end{funcdesc}
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.
39 \end{funcdesc}
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
44 base64 encoded data.
45 \end{funcdesc}