? Lib/test/.test_base64.py.swp ? Mac/IDE scripts/Hold option to open a script ? Mac/IDE scripts/Insert file name ? Mac/IDE scripts/Insert folder name ? Mac/IDE scripts/Search Python Documentation ? Mac/IDE scripts/Hack/Remove .pyc files ? Mac/IDE scripts/Hack/Toolbox Assistant Index: Lib/base64.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/base64.py,v retrieving revision 1.16 diff -u -r1.16 base64.py --- Lib/base64.py 12 Feb 2004 17:35:05 -0000 1.16 +++ Lib/base64.py 27 Mar 2005 21:24:49 -0000 @@ -221,12 +221,15 @@ acc += _b32rev[c] << shift shift -= 5 if shift < 0: - parts.append(binascii.unhexlify(hex(acc)[2:-1])) + parts.append(binascii.unhexlify("%010x" % acc)) acc = 0 shift = 35 # Process the last, partial quanta - last = binascii.unhexlify(hex(acc)[2:-1]) - if padchars == 1: + last = binascii.unhexlify("%010x" % acc) + + if padchars == 0: + last = '' #no chars + elif padchars == 1: last = last[:-1] elif padchars == 3: last = last[:-2] @@ -234,7 +237,7 @@ last = last[:-3] elif padchars == 6: last = last[:-4] - elif padchars <> 0: + else: raise TypeError('Incorrect padding') parts.append(last) return EMPTYSTRING.join(parts)