1 \section{\module{base64
} ---
2 Encode and decode MIME base64 data
}
4 \declaremodule{standard
}{base64
}
5 \modulesynopsis{Encode and decode files using the MIME base64 data.
}
8 \indexii{base64
}{encoding
}
9 \index{MIME!base64 encoding
}
11 This module performs base64 encoding and decoding of arbitrary binary
12 strings into text strings that can be safely emailed or posted. The
13 encoding scheme is defined in
\rfc{1421} (``Privacy Enhancement for
14 Internet Electronic Mail: Part I: Message Encryption and
15 Authentication Procedures'', section
4.3.2.4, ``Step
4: Printable
16 Encoding'') and is used for MIME email and
17 various other Internet-related applications; it is not the same as the
18 output produced by the
\program{uuencode
} program. For example, the
19 string
\code{'www.python.org'
} is encoded as the string
20 \code{'d3d3LnB5dGhvbi5vcmc=
\e n'
}.
23 \begin{funcdesc
}{decode
}{input, output
}
24 Decode the contents of the
\var{input
} file and write the resulting
25 binary data to the
\var{output
} file.
26 \var{input
} and
\var{output
} must either be file objects or objects that
27 mimic the file object interface.
\var{input
} will be read until
28 \code{\var{input
}.read()
} returns an empty string.
31 \begin{funcdesc
}{decodestring
}{s
}
32 Decode the string
\var{s
}, which must contain one or more lines of
33 base64 encoded data, and return a string containing the resulting
37 \begin{funcdesc
}{encode
}{input, output
}
38 Encode the contents of the
\var{input
} file and write the resulting
39 base64 encoded data to the
\var{output
} file.
40 \var{input
} and
\var{output
} must either be file objects or objects that
41 mimic the file object interface.
\var{input
} will be read until
42 \code{\var{input
}.read()
} returns an empty string.
45 \begin{funcdesc
}{encodestring
}{s
}
46 Encode the string
\var{s
}, which can contain arbitrary binary data,
47 and return a string containing one or more lines of
53 \seemodule{binascii
}{support module containing
\ASCII{}-to-binary
54 and binary-to-
\ASCII{} conversions
}