Skip to content

Performance Issues on Android #23

@srz2

Description

@srz2

So I am trying to use this for android and it works but the performance is terrible. It takes several seconds to decrypt an asset I have.

For instance, I have images as low as 50KB to 150KB so nothing too large. But whenever I try to decrypt them, it takes several seconds for them to process. I use this for iOS and it's nearly instantaneous. Would anyone have any suggestions? The function I am using for this process is below...

public byte[] decryptInputStream(InputStream in){
if(in == null)
return null;

    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    byte[] buffer = new byte[1024];
    int i = Integer.MAX_VALUE;
    try{
        while((i = in.read(buffer, 0, buffer.length)) > 0)
            outputStream.write(buffer, 0, i);
    }
    catch(Exception e){

    }
    try {
        byte[] decrpytedStream = decryptor.decryptData(outputStream.toByteArray(), KEY.toCharArray());
        return decrpytedStream;
    }
    catch(CryptorException e){
        Log.e("AES Cryptor", "Input Stream Decryption Error");
    }
    return null;
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions