You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Alex Herbert (Jira)" <ji...@apache.org> on 2020/04/22 21:06:00 UTC

[jira] [Commented] (CODEC-288) during Base64 decode for 24 byte length string ,the function returns byte array which is less than 18 bytes

    [ https://issues.apache.org/jira/browse/CODEC-288?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17090042#comment-17090042 ] 

Alex Herbert commented on CODEC-288:
------------------------------------

1.5 is an old version of codec. Can you update to a later version?

On 1.15-SNAPSHOT this:
{code:java}
@Test
public void testCodec288() {
    String input = "AQAAAAFxB7VyAgAAAAEPEMdg";
    byte[] output = Base64.decodeBase64(input);
    System.out.printf("%d = %s%n", output.length, Arrays.toString(output));
}
{code}
Outputs this:

{noformat}
18 = [1, 0, 0, 0, 1, 113, 7, -75, 114, 2, 0, 0, 0, 1, 15, 16, -57, 96]
{noformat}

Which appears to be as expected.


> during Base64 decode for 24 byte length string ,the function returns byte array which is less than 18 bytes
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: CODEC-288
>                 URL: https://issues.apache.org/jira/browse/CODEC-288
>             Project: Commons Codec
>          Issue Type: Bug
>    Affects Versions: 1.5
>         Environment: effected all the stacks
>            Reporter: sagarika
>            Priority: Major
>
> string of byte length 24 AQAAAAFxB7VyAgAAAAEPEMdg
> returned byte array length :6 ideally it should be of length 18.
>  
> public byte[] decode(String pArray) {
>  return this.decode(StringUtils.getBytesUtf8(pArray));
> }



--
This message was sent by Atlassian Jira
(v8.3.4#803005)