[Python-Dev] b32encode and NUL bytes
Jeff Epler
jepler at unpythonic.net
Fri Jun 10 20:13:35 CEST 2005
On Tue, Jun 07, 2005 at 08:23:18PM -0700, Pavel Pergamenshchik wrote:
> Hi.
> Is this a feature? I do see b32encode padding the string with NULs first.
>
> >>> b32decode(b32encode('\x00'))
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> File "/usr/lib/python2.4/base64.py", line 228, in b32decode
> last = binascii.unhexlify(hex(acc)[2:-1])
> TypeError: Odd-length string
This also seems suspect:
>>> base64.b32encode("\0a")
'ABQQ===='
>>> base64.b32decode(_)
'a'
Jeff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.python.org/pipermail/python-dev/attachments/20050610/36128810/attachment.pgp
More information about the Python-Dev
mailing list