Bug in Encoder.java

1 message, no reply - 1444 views

Hi,

There seems to be a bug in the Base64 decoder. For example, passing the following string into the decoder:

AAAATgAAAAUAAAAZAAAABQAAAE4AAAAhAAAA//////////8AGQAAAAAAB1BhdHJpY2sAAAAAAAAAAAAAAAA=

Produces (byte values separated by comma):

0,0,0,78,0,0,0,5,0,0,0,25,0,0,0,5,0,0,0,78,0,0,0,33,0,0,0,-1,-1,-1,-1,-1,-1,-1,-1,0,

25,0,0,0,0,0,7,80,97,116,114,105,99,107,0,0,0,0,0,0,0,0,0,0,-1,-1,16

But the correct bytes are:

0,0,0,78,0,0,0,5,0,0,0,25,0,0,0,5,0,0,0,78,0,0,0,33,0,0,0,-1,-1,-1,-1,-1,-1,-1,-1,0,

25,0,0,0,0,0,7,80,97,116,114,105,99,107,0,0,0,0,0,0,0,0,0,0,0,0

(Note the -1, -1, 16 sequence at the end)

In addition, shouldn't the minus character (last character) in the hash be a forward slash '/'?

Will.