This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Add Base32 support for RFC4648 "Extended Hex" alphabet (patch attached)
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.10
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: FFY00, cheryl.sabella, ezio.melotti, martin.panter, matthaeus.wander, miss-islington, p-ganssle, pitrou, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2013-01-18 18:21 by matthaeus.wander, last changed 2022-04-11 14:57 by admin. This issue is now closed.

File name Uploaded Description Edit
base32hex.tar.gz matthaeus.wander, 2013-01-18 18:21 Patches for Python 2.7 and 3
py3_base32hex.patch matthaeus.wander, 2013-01-18 18:51 Patch for Python 3 review
py3_base32hex.patch matthaeus.wander, 2015-07-22 16:50 Patch for 3.5 or 3.6 review
py36_base32hex.patch matthaeus.wander, 2015-07-23 14:15 *fixed* Patch for 3.6
py36_base32hex.patch serhiy.storchaka, 2015-07-23 14:50 Regenerated for review review
Pull Requests
URL Status Linked Edit
PR 20441 merged FFY00, 2020-05-27 00:08
Messages (12)
msg180206 - (view) Author: Matthäus Wander (matthaeus.wander) Date: 2013-01-18 18:21
RFC4648 specifies two different alphabets for Base32: 1) the common one already used in RFC3548 and implemented in Python, and 2) an "Extended Hex" alphabet which is used by e.g. DNSSEC NSEC3 but not yet implemented in Python.

The attached patches add the "Extended Hex" alphabet to Python 2.7 and 3 via an optional parameter 'base32hex=False'. Default behavior is not changed.

patch Lib/ < py27_base64.patch
patch Lib/test/ < py27_test_base64.patch
msg180207 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2013-01-18 18:26
Since this is a new feature it can go on 3.4 only.
It would also be better to include both the changes for and in a single patch and attach that, rather than uploading an archive that contains both.

FTR the links to the relevant RFCs are:
msg180210 - (view) Author: Matthäus Wander (matthaeus.wander) Date: 2013-01-18 18:51
Added single patch as requested.
msg243591 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-05-19 13:57
The patch can't be longer applied cleanly. It should be synchronized with sources. It is the last chance for this feature to get to 3.5 if somebody will update the patch and add the documentation.

The feature itself LGTM. The only my doubt is about the name of boolean parameter. "base32hex" is recommended as encoding name. Parameter can be named as "exthex" or "extended_hex". Or may be add separate functions b32hexencode/b32hexdecode. I'm not sure.
msg247134 - (view) Author: Matthäus Wander (matthaeus.wander) Date: 2015-07-22 16:50
I've created a new patch that works against the current 3.5 sources. Should be fine for 3.6, I guess.

Separate functions b32hexencode and b32hexdecode are used now. There is no optional parameter "base32hex" anymore.
msg247158 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2015-07-23 01:21
Matthäus, I think you uploaded the old patch again by accident. Also, see Berker’s old comments about documentation, and my new suggestions, on the Rietveld code review, if you haven’t already.
msg247205 - (view) Author: Matthäus Wander (matthaeus.wander) Date: 2015-07-23 14:15
*facepalm* Yes, I uploaded the old patch twice. Sorry for that.

- Added doc update.
- Added test case that includes all 32 characters codes.

I'm reusing the existing Base32 table generation logic without changes. It has been changed (in 3.4 or so) since the first patch. If the logic is still to be changed as suggested by Martin in Rietveld review, I'd suggest to open a separate issue because it affects the existing Base32 implementation, too.
msg247216 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-07-23 15:26
Added comments on Rietveld.
msg338962 - (view) Author: Cheryl Sabella (cheryl.sabella) * (Python committer) Date: 2019-03-27 14:22
Is there interest in having this patch converted to a pull request?
msg375123 - (view) Author: miss-islington (miss-islington) Date: 2020-08-10 14:48
New changeset 4ce6faa6c9591de6079347eccc9e61ae4e8d9e31 by Filipe Laíns in branch 'master':
bpo-16995: add support for base32 extended hex (base32hex) (GH-20441)
msg375137 - (view) Author: Filipe Laíns (FFY00) * (Python triager) Date: 2020-08-10 18:58
Paul, the PR is now merged :). Can you close the bug?
msg375138 - (view) Author: Paul Ganssle (p-ganssle) * (Python committer) Date: 2020-08-10 19:00
Thanks Filipe!
Date User Action Args
2022-04-11 14:57:40adminsetgithub: 61199
2020-08-10 19:00:47p-gansslesetstatus: open -> closed
versions: + Python 3.10, - Python 3.8
messages: + msg375138

resolution: fixed
stage: patch review -> resolved
2020-08-10 18:58:59FFY00setnosy: + p-ganssle
messages: + msg375137
2020-08-10 14:48:28miss-islingtonsetnosy: + miss-islington
messages: + msg375123
2020-05-27 00:08:10FFY00setnosy: + FFY00
pull_requests: + pull_request19697
2019-03-27 14:22:28cheryl.sabellasetnosy: + cheryl.sabella

messages: + msg338962
versions: + Python 3.8, - Python 3.6
2015-07-23 15:26:24serhiy.storchakasetstage: needs patch -> patch review
2015-07-23 15:26:16serhiy.storchakasetmessages: + msg247216
2015-07-23 14:50:03serhiy.storchakasetfiles: + py36_base32hex.patch
2015-07-23 14:15:35matthaeus.wandersetfiles: + py36_base32hex.patch

messages: + msg247205
2015-07-23 08:41:18serhiy.storchakasetstage: patch review -> needs patch
2015-07-23 01:21:05martin.pantersetnosy: + martin.panter
messages: + msg247158
2015-07-22 16:50:52matthaeus.wandersetfiles: + py3_base32hex.patch

messages: + msg247134
versions: + Python 3.6, - Python 3.5
2015-05-19 13:57:38serhiy.storchakasetnosy: + pitrou
messages: + msg243591
2015-05-19 13:38:13serhiy.storchakasetstage: patch review
versions: + Python 3.5, - Python 3.4
2013-05-18 18:57:14serhiy.storchakasetnosy: + serhiy.storchaka
2013-01-18 18:51:10matthaeus.wandersetfiles: + py3_base32hex.patch
keywords: + patch
messages: + msg180210
2013-01-18 18:26:11ezio.melottisetnosy: + ezio.melotti

messages: + msg180207
versions: + Python 3.4, - Python 2.7, Python 3.5
2013-01-18 18:21:19matthaeus.wandercreate