-
-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Base32 support for RFC4648 "Extended Hex" alphabet (patch attached) #61199
Comments
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/base64.py < py27_base64.patch |
Since this is a new feature it can go on 3.4 only. FTR the links to the relevant RFCs are: |
Added single patch as requested. |
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. |
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. |
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. |
*facepalm* Yes, I uploaded the old patch twice. Sorry for that.
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. |
Added comments on Rietveld. |
Is there interest in having this patch converted to a pull request? |
Paul, the PR is now merged :). Can you close the bug? |
Thanks Filipe! |
…2{en,de}code()*` (pythonGH-111785) Minor cleanup after commit 4ce6faa
…2{en,de}code()*` (pythonGH-111785) Minor cleanup after commit 4ce6faa
…2{en,de}code()*` (pythonGH-111785) Minor cleanup after commit 4ce6faa
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
Linked PRs
base64._b32{en,de}code()*
#111785The text was updated successfully, but these errors were encountered: