El cifrado en 3DES tarda mucho

Angel
25 de Enero del 2005
Hola:

Estoy realizando cifrado con TripleDES (DESede), y he observado que tarda mucho tiempo en realizar el cifrado. Así un pequeño fichero (1KB) me lleva un tiempo de 15 segundos y uno mas grande (800 KB) puede llevar 15 minutos.

El codigo es el siguiente y creo que es correcto, pues si que cifra, pero tarda mucho. Que es lo que puede estar mal?.

Cipher desCipher = null;

// Create the cipher
try {
desCipher = Cipher.getInstance("DESede");
} catch (NoSuchAlgorithmException e) {e.printStackTrace();}
catch (NoSuchPaddingException e) {e.printStackTrace();}

// Initialize the cipher for encryption
try {
desCipher.init(Cipher.ENCRYPT_MODE, desKey);
} catch (InvalidKeyException e1) {e1.printStackTrace();}

byte[] textoACifrarByte = textoACifrar.getBytes();

// Encrypt the cleartext
byte[] ciphertext = null;
try {
System.out.println("Texto claro: "+toHexadecimal(textoACifrarByte));
ciphertext = desCipher.doFinal(textoACifrarByte);
System.out.println("Texto cifrado: "+toHexadecimal(ciphertext));
} catch (IllegalStateException e2) {e2.printStackTrace();}
catch (IllegalBlockSizeException e2) {e2.printStackTrace();}
catch (BadPaddingException e2) {e2.printStackTrace();}