[ python-Bugs-1170331 ] Error in base64.b32decode
SourceForge.net
noreply at sourceforge.net
Sun Mar 27 21:48:26 CEST 2005
Bugs item #1170331, was opened at 2005-03-24 22:05
Message generated for change (Comment added) made by logistix
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1170331&group_id=5470
Category: Extension Modules
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: toidinamai (toidinamai)
Assigned to: Nobody/Anonymous (nobody)
Summary: Error in base64.b32decode
Initial Comment:
Hi,
I believe there is an error in base64.b32decode because
it doesn't seem to
allow to decode arbitrary binary data:
<code>
#!/usr/bin/env python2.4
import base64
b64d = base64.b64decode
b64e = base64.b64encode
print "base64: ", repr(b64d(b64e('\x00')))
b16d = base64.b16decode
b16e = base64.b16encode
print "base16: ", repr(b16d(b16e('\x00')))
b32d = base64.b32decode
b32e = base64.b32encode
print "base32: ", repr(b32d(b32e('\x00')))
</code>
This raises a very strange exception:
Traceback (most recent call last):
File "test.py", line 18, in ?
print "base32: ", repr(b32d(b32e('\x00')))
File "/usr/lib/python2.4/base64.py", line 228, in
b32decode
last = binascii.unhexlify(hex(acc)[2:-1])
TypeError: Odd-length string
b32 should work just like b64 and b16.
Best regards
Frank Bensktein.
----------------------------------------------------------------------
Comment By: logistix (logistix)
Date: 2005-03-27 13:48
Message:
Logged In: YES
user_id=699438
patch 1171487 posted. It is pure python so you should be
able to incorporate into your existing codebase relatively
easily. You won't need to rebuild the python executable.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1170331&group_id=5470
More information about the Python-bugs-list
mailing list