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