My file encryption is very slow! 2 minutes for 70 Mb. I use this library and class for Encrypting files. It works but it's very slow. E.g. for a file .mp4 (70Mb) the encryption takes 2 minutes.
I searched a lot in this site and internet but couldn't find a fast way. My encrypt class is JealousSky :
My code for Encryption is this :
try {
jealousSky.initialize(
"longestPasswordEverCreatedInAllTheUniverseOrMore",
"FFD7BADF2FBB1999");
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
try {
InputStream is = new FileInputStream(listFiles[position]);
jealousSky.encryptToFile(is,listFiles[position].getParent()+"/"+EncName);
givenFile.delete();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (InvalidKeySpecException e) {
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (BadPaddingException e) {
e.printStackTrace();
} catch (InvalidKeyException e) {
e.printStackTrace();
} catch (InvalidAlgorithmParameterException e) {
e.printStackTrace();
} catch (NoSuchPaddingException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (IllegalBlockSizeException e) {
e.printStackTrace();
}
Edit :
Solution
in JealousSky.class and encrypt method must to change (getEncryptInputStream) to (getDecryptFromCipherInputStream)
finaly 2min decreased to 12s