gh-101178: Add Ascii85, Base85, and Z85 support to binascii#102753
Merged
serhiy-storchaka merged 45 commits intopython:mainfrom Feb 6, 2026
Merged
gh-101178: Add Ascii85, Base85, and Z85 support to binascii#102753serhiy-storchaka merged 45 commits intopython:mainfrom
serhiy-storchaka merged 45 commits intopython:mainfrom
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Synopsis
Add Ascii85, Base85, and Z85 encoder and decoder functions implemented in C to
binasciiand use them to greatly improve the performance and reduce the memory usage of the existing Ascii85, Base85, and Z85 codec functions inbase64.No API or documentation changes are necessary with respect to any functions in
base64, and all existing unit tests for those functions continue to pass without modification.Resolves: gh-101178
Discussion
The base85-related functions in
base64are now wrappers for the new functions inbinascii, as envisioned in the docs:Parting out Ascii85 from Base85 and Z85 was warranted in my testing despite the code duplication due to the various performance-murdering special cases in Ascii85.
Comments and questions are welcome.
Benchmarks
Updated December 28, 2025.
The old pure-Python implementation is two orders of magnitude slower and uses over O(40n) temporary memory.