Issue 1170331: Error in base64.b32decode (original) (raw)
Issue1170331
Created on 2005-03-25 04:05 by toidinamai, last changed 2022-04-11 14:56 by admin. This issue is now closed.
| Messages (4) | ||
|---|---|---|
| msg24783 - (view) | Author: Frank Benkstein (toidinamai) | Date: 2005-03-25 04:05 |
Hi, I believe there is an error in base64.b32decode because it doesn't seem to allow to decode arbitrary binary data: #!/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'))) 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. |
||
| msg24784 - (view) | Author: Grant Olson (logistix) | Date: 2005-03-27 19:48 |
| 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. | ||
| msg24785 - (view) | Author: Terry J. Reedy (terry.reedy) * ![]() |
Date: 2005-03-30 18:35 |
| Logged In: YES user_id=593130 Your original report somehow got larded with blank lines that spread it over 4 screens. If you can somehow prevent this next time, it would be much easier to read. | ||
| msg24786 - (view) | Author: A.M. Kuchling (akuchling) * ![]() |
Date: 2005-06-08 22:54 |
| Logged In: YES user_id=11375 Fixed by applying patch #1171487, to both HEAD and 2.4-maint branches. Thanks for reporting this! |
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:56:10 | admin | set | github: 41757 |
| 2005-03-25 04:05:54 | toidinamai | create |
