blob: c487576ae617037df537a2ba897ed3d6baa5eb8b [file] [log] [blame]
Guido van Rossume76b7a81997-04-27 21:25:52 +00001\section{Standard Module \sectcode{base64}}
2\stmodindex{base64}
3
4This module perform base-64 encoding and decoding of arbitrary binary
5strings into text strings that can be safely emailed or posted. The
6encoding scheme is defined in RFC 1421 and is used for MIME email and
7various other Internet-related applications; it is not the same as the
8output produced by the \file{uuencode} program. For example, the
9string \code{'www.python.org'} is encoded as the string
10\code{'d3d3LnB5dGhvbi5vcmc=\e n'}.
11\indexii{base-64}{encoding}
12\indexii{RFC}{1421}
13\index{MIME, base 64 encoding}
14
15\begin{funcdesc}{decode}{input\, output}
16Decode the contents of the \var{input} file and write the resulting
17binary data to the \var{output} file.
18\var{input} and \var{output} must either be file objects or objects that
19mimic the file object interface. \var{input} will be read until
20\code{\var{input}.read()} returns an empty string.
21\end{funcdesc}
22
23\begin{funcdesc}{decodestring}{s}
24Decode the string \var{s}, which must contain one or more lines of
25base-64 encoded data, and return a string containing the resulting
26binary data.
27\end{funcdesc}
28
29\begin{funcdesc}{encode}{input\, output}
30Encode the contents of the \var{input} file and write the resulting
31base-64 encoded data to the \var{output} file.
32\var{input} and \var{output} must either be file objects or objects that
33mimic the file object interface. \var{input} will be read until
34\code{\var{input}.read()} returns an empty string.
35\end{funcdesc}
36
37\begin{funcdesc}{encodestring}{s}
38Encode the string \var{s}, which can contain arbitrary binary data,
39and return a string containing one or more lines of
40base-64 encoded data.
41\end{funcdesc}
42
43