8000 Updated obsolete references for RFC 3548 to RFC 4648 · python/cpython@9cdba94 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9cdba94

Browse files
committed
Updated obsolete references for RFC 3548 to RFC 4648
1 parent ea00798 commit 9cdba94

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

Doc/library/base64.rst

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
===============================================================
33

44
.. module:: base64
5-
:synopsis: RFC 3548: Base16, Base32, Base64 Data Encodings;
5+
:synopsis: RFC 4648: Base16, Base32, Base64 Data Encodings;
66
Base85 and Ascii85
77

88
**Source code:** :source:`Lib/base64.py`
@@ -16,10 +16,10 @@
1616
This module provides functions for encoding binary data to printable
1717
ASCII characters and decoding such encodings back to binary data.
1818
It provides encoding and decoding functions for the encodings specified in
19-
:rfc:`3548`, which defines the Base16, Base32, and Base64 algorithms,
19+
:rfc:`4648`, which defines the Base16, Base32, and Base64 algorithms,
2020
and for the de-facto standard Ascii85 and Base85 encodings.
2121

22-
The :rfc:`3548` encodings are suitable for encoding binary data so that it can
22+
The :rfc:`4648` encodings are suitable for encoding binary data so that it can
2323
safely sent by email, used as parts of URLs, or included as part of an HTTP
2424
POST request. The encoding algorithm is not the same as the
2525
:program:`uuencode` program.
@@ -28,7 +28,7 @@ There are two interfaces provided by this module. The modern interface
2828
supports encoding :term:`bytes-like objects <bytes-like object>` to ASCII
2929
:class:`bytes`, and decoding :term:`bytes-like objects <bytes-like object>` or
3030
strings containing ASCII to :class:`bytes`. Both base-64 alphabets
31-
defined in :rfc:`3548` (normal, and URL- and filesystem-safe) are supported.
31+
defined in :rfc:`4648` (normal, and URL- and filesystem-safe) are supported.
3232

3333
The legacy interface does not support decoding from strings, but it does
3434
provide functions for encoding and decoding to and from :term:`file objects
@@ -124,12 +124,13 @@ The modern interface provides:
124124
whether a lowercase alphabet is acceptable as input. For security purposes,
125125
the default is ``False``.
126126

127-
:rfc:`3548` allows for optional mapping of the digit 0 (zero) to the letter O
127+
One might desire an optional mapping of the digit 0 (zero) to the letter O
128128
(oh), and for optional mapping of the digit 1 (one) to either the letter I (eye)
129129
or letter L (el). The optional argument *map01* when not ``None``, specifies
130130
which letter the digit 1 should be mapped to (when *map01* is not ``None``, the
131131
digit 0 is always mapped to the letter O). For security purposes the default is
132-
``None``, so that 0 and 1 are not allowed in the input.
132+
``None``, so that 0 and 1 are not allowed in the input. Note that :rfc:`4648`
133+
(which made :rfc:`3548` obsolete) did not allow such a mapping.
133134

134135
A :exc:`binascii.Error` is raised if *s* is
135136
incorrectly padded or if there are non-alphabet characters present in the

Lib/base64.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#! /usr/bin/env python3
22

3-
"""Base16, Base32, Base64 (RFC 3548), Base85 and Ascii85 data encodings"""
3+
"""Base16, Base32, Base64 (RFC 4648), Base85 and Ascii85 data encodings"""
44

55
# Modified 04-Oct-1995 by Jack Jansen to use binascii module
6-
# Modified 30-Dec-2003 by Barry Warsaw to add full RFC 3548 support
6+
# Modified 30-Dec-2003 by Barry Warsaw to add full RFC 4648 support
77
# Modified 22-May-2007 by Guido van Rossum to use bytes everywhere
88

99
import re
@@ -183,13 +183,14 @@ def b32decode(s, casefold=False, map01=None):
183183
Optional casefold is a flag specifying whether a lowercase alphabet is
184184
acceptable as input. For security purposes, the default is False.
185185
186-
RFC 3548 allows for optional mapping of the digit 0 (zero) to the
186+
One might desire an optional mapping of the digit 0 (zero) to the
187187
letter O (oh), and for optional mapping of the digit 1 (one) to
188188
either the letter I (eye) or letter L (el). The optional argument
189189
map01 when not None, specifies which letter the digit 1 should be
190190
mapped to (when map01 is not None, the digit 0 is always mapped to
191191
the letter O). For security purposes the default is None, so that
192-
0 and 1 are not allowed in the input.
192+
0 and 1 are not allowed in the input. Note that RFC 4648 (which
193+
made RFC 3548 obsolete) did not allow such a mapping.
193194
194195
The result is returned as a bytes object. A binascii.Error is raised if
195196
the input is incorrectly padded or if there are non-alphabet
@@ -248,7 +249,7 @@ def b32decode(s, casefold=False, map01=None):
248249

249250

250251

251-
# RFC 3548, Base 16 Alphabet specifies uppercase, but hexlify() returns
252+
# RFC 4648, Base 16 Alphabet specifies uppercase, but hexlify() returns
252253
# lowercase. The RFC also recommends against accepting input case
253254
# insensitively.
254255
def b16encode(s):

0 commit comments

Comments
 (0)
0