[Python-Dev] b32encode and NUL bytes

Pavel Pergamenshchik pp64 at codelock.com
Wed Jun 8 05:23:18 CEST 2005

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

More information about the Python-Dev mailing list