[Ace-users] [ace-bugs] Bug in ACE_Base64

J.T. Conklin jtc at acorntoolworks.com
Thu Dec 13 22:30:51 CST 2007


alick_nie <alick_nie at 163.com> writes:
> I have encounter a problem when using ACE_Base64 encode method.
>
> For exameple, when "abcdfgi" is encoded under base 64 algorithm, the
> result should be "YWJjZGZnaQ==".  But the result, which ACE_base64
> returns, add a "\n" to the end of "YWJjZGZnaQ==".
>
> How can I get the right result?

Hi,

The ACE_Base64 implementation is "right", just not what you want.
When it encodes the data, the output is split into 72 column "chunks"
(RFC 2045 allows up to 76 columns) each terminated by a newline.

It looks like the encodeBase64() method in the Java base64 API has a
isChunked parameter to control whether the output is "chunked". This
option could be added to ACE's encoder without too much difficulty.

The Python Base64 API is based on RFC 3548. and has support for
alternate alphabets (mapping + to - and / to _ which are URL and
filename safe; or mapping 0 to O and 1 to I which is human safe).
It also has support for Base16 and Base32 encodings.  Adding this
to ACE wouldn't be as trivial as the above, but it might be useful.

    --jtc

-- 
J.T. Conklin



More information about the Ace-users mailing list