Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 35.2k
gh-101178: Add Ascii85, Base85, and Z85 support to binascii#102753
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
05ae5adaa06c5d63774406c0e4a3ce4773c4072e3bbc9217f2c40ba0fd9eaf74746d18d0755936d65feca2413560df9a4060fbd7ca070887167e83e01df44278859181e928e32691a0ab9d27bd780517abc9a66ddc1d3fcc5de5a13bb3b186f09fa86d8f8973582492879dd863cdc3c58adaf2c2b2ecc4da165d1bf32f9974f6ceb4ba3e5099e0bdecc6d48530f54a137df73556a02b2adb19220730fdfFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -98,6 +98,112 @@ The :mod:`binascii` module defines the following functions: | ||
| Added the *wrapcol* parameter. | ||
| .. function:: a2b_ascii85(string, /, *, foldspaces=False, adobe=False, ignorechars=b"") | ||
| Convert Ascii85 data back to binary and return the binary data. | ||
| Valid Ascii85 data contains characters from the Ascii85 alphabet in groups | ||
| of five (except for the final group, which may have from two to five | ||
| characters). Each group encodes 32 bits of binary data in the range from | ||
| ``0`` to ``2 ** 32 - 1``, inclusive. The special character ``z`` is | ||
| accepted as a short form of the group ``!!!!!``, which encodes four | ||
| consecutive null bytes. | ||
| *foldspaces* is a flag that specifies whether the 'y' short sequence | ||
| should be accepted as shorthand for 4 consecutive spaces (ASCII 0x20). | ||
| This feature is not supported by the "standard" Ascii85 encoding. | ||
| *adobe* controls whether the input sequence is in Adobe Ascii85 format | ||
| (i.e. is framed with <~ and ~>). | ||
| *ignorechars* should be a :term:`bytes-like object` containing characters | ||
| to ignore from the input. | ||
| This should only contain whitespace characters. | ||
| Invalid Ascii85 data will raise :exc:`binascii.Error`. | ||
| .. versionadded:: next | ||
| .. function:: b2a_ascii85(data, /, *, foldspaces=False, wrapcol=0, pad=False, adobe=False) | ||
| Convert binary data to a formatted sequence of ASCII characters in Ascii85 | ||
| coding. The return value is the converted data. | ||
| *foldspaces* is an optional flag that uses the special short sequence 'y' | ||
| instead of 4 consecutive spaces (ASCII 0x20) as supported by 'btoa'. This | ||
| feature is not supported by the "standard" Ascii85 encoding. | ||
| If *wrapcol* is non-zero, insert a newline (``b'\n'``) character | ||
| after at most every *wrapcol* characters. | ||
| If *wrapcol* is zero (default), do not insert any newlines. | ||
| If *pad* is true, the input is padded with ``b'\0'`` so its length is a | ||
| multiple of 4 bytes before encoding. | ||
| Note that the ``btoa`` implementation always pads. | ||
| *adobe* controls whether the encoded byte sequence is framed with ``<~`` | ||
| and ``~>``, which is used by the Adobe implementation. | ||
| .. versionadded:: next | ||
| .. function:: a2b_base85(string, /) | ||
| Convert Base85 data back to binary and return the binary data. | ||
| More than one line may be passed at a time. | ||
| Valid Base85 data contains characters from the Base85 alphabet in groups | ||
| of five (except for the final group, which may have from two to five | ||
| characters). Each group encodes 32 bits of binary data in the range from | ||
| ``0`` to ``2 ** 32 - 1``, inclusive. | ||
| Invalid Base85 data will raise :exc:`binascii.Error`. | ||
| .. versionadded:: next | ||
| .. function:: b2a_base85(data, /, *, pad=False) | ||
| Convert binary data to a line of ASCII characters in Base85 coding. | ||
| The return value is the converted line. | ||
| If *pad* is true, the input is padded with ``b'\0'`` so its length is a | ||
| multiple of 4 bytes before encoding. | ||
| .. versionadded:: next | ||
| .. function:: a2b_z85(string, /) | ||
| Convert Z85 data back to binary and return the binary data. | ||
| More than one line may be passed at a time. | ||
| Valid Z85 data contains characters from the Z85 alphabet in groups | ||
| of five (except for the final group, which may have from two to five | ||
| characters). Each group encodes 32 bits of binary data in the range from | ||
| ``0`` to ``2 ** 32 - 1``, inclusive. | ||
serhiy-storchaka marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| See `Z85 specification <https://rfc.zeromq.org/spec/32/>`_ for more information. | ||
| Invalid Z85 data will raise :exc:`binascii.Error`. | ||
| .. versionadded:: next | ||
| .. function:: b2a_z85(data, /, *, pad=False) | ||
| Convert binary data to a line of ASCII characters in Z85 coding. | ||
| The return value is the converted line. | ||
| If *pad* is true, the input is padded with ``b'\0'`` so its length is a | ||
| multiple of 4 bytes before encoding. | ||
| See `Z85 specification <https://rfc.zeromq.org/spec/32/>`_ for more information. | ||
serhiy-storchaka marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| .. versionadded:: next | ||
| .. function:: a2b_qp(data, header=False) | ||
| Convert a block of quoted-printable data back to binary and return the binary | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.